Control Flow Flashcards
1
Q
If you want to see whether the value of a variable is in the range of lets say one to 10(including 10) what are three different ways you could do this?
A
age.gets.chomp.to_i
if (0..10) === age
puts “Yes!”
end
if (0.10).include?(age)
puts “Yes!”
end
case age
when 0..10 then puts “Yes!”
end