+ 1

(SOLVED) whats wrong in this code? (Ruby)

puts "Welcome to the Driver License Test! Please enter your age.." age = gets.chomp if age < 18 puts "You are too young for driver license!" else puts "Here's your driver license sir!" end

6th Dec 2020, 10:54 AM
Musab Emre Deniz
Musab Emre Deniz - avatar
2 Respuestas
+ 3
Use the `to_i` method to convert the input to integer to be able to compare it with 18. Change the line taking the input to age = gets.chomp.to_i
6th Dec 2020, 11:03 AM
XXX
XXX - avatar
+ 1
XXX a lot of thanks <3
6th Dec 2020, 11:04 AM
Musab Emre Deniz
Musab Emre Deniz - avatar