+ 13

Please help me to correct code in ruby

age = gets case #{age} when 1, 2, 3, 4, 5, 6 puts "impossible too young for coding" when 7, 8, 9 puts "Good, started coding at right age" when 10, 11, 12, 13, 14 puts "Keep it up" when 15, 16, 17, 18 puts "time for making career in programming" when 19, 20, 21, 22, 23, 24, 25, 26, puts "Hope you finds your career in programming" else puts "XYZ" end I don't know when I input any age like 13, 21 the program returns "impossible too young for coding" how to solve that please help me.

23rd Mar 2017, 10:27 AM
Ekansh
2 Answers
+ 15
age = gets.to_i case age The rest is correct.
23rd Mar 2017, 5:35 PM
Tashi N
Tashi N - avatar
+ 14
thanks
24th Mar 2017, 9:46 AM
Ekansh