+ 1
What's wrong
print "enter a number: " enter = gets.chomp() if enter > 5 puts "higher than five" else print "lower than five" end Why dont this work?
4 Réponses
+ 2
alright, thanks!
+ 1
gets.chomp().to_i
gets.chomp() defaults a string. by using .to_i it will take an integer instead, which can then be compared to 5
+ 1
Could one of you mention what language this is?
+ 1
Ruby