0
How do I use gets.chomp for age and same time use if-statements
I want to use gets.chomp to find out age, and combine it with if to print out the basic "too young" or above 18, but I just get error when I try to run it. Anyone that gets what I'm missing? https://code.sololearn.com/cfEcU6l0JNns/?ref=app
2 Respostas
0
Convert the input to integer with .to_i method on line 2
gets returns a string by default which fails "17" > 18
age = gets.chomp.to_i
0
Omg, can't belive I missed that xD thank you!