Repeating and Making Choices : times « Statement « Ruby
- Ruby
- Statement
- times
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
Related examples in the same category