0

Hello, what's wrong with my code?

Im a beginner, i wanted to know what's with this code: age = gets if age < 20 puts "you are below 20" if age > 20 puts "you are above 20" end end

11th Jun 2020, 5:53 PM
mad M
mad M - avatar
2 ответов
+ 3
In other words, you have to convert your gets to integer, as it is a string be default. Only then can you compare it to a number.
11th Jun 2020, 6:10 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
0
Thank you :D, it works now, have a nice day!
11th Jun 2020, 8:56 PM
mad M
mad M - avatar