Mega Code Archive

 
Categories / Ruby / Statement
 

Repeating and Making Choices

3.times do      print "Enter a value: "      STDOUT.flush      value = gets.to_i           if value == 1          puts "one"      elsif value == 2          puts "two"      else          puts "many"      end      puts  end