Why does this “gets” not work? If I place an integer in place of “gets” the program works fine. Curious! | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
0

Why does this “gets” not work? If I place an integer in place of “gets” the program works fine. Curious!

https://code.sololearn.com/c1BOTWNry6lk/?ref=app

26th Apr 2018, 7:21 PM
Charles W Hsu
Charles W Hsu - avatar
2 Respuestas
+ 3
You might want to convert num to a number, not a string: num = gets.to_i
26th Apr 2018, 7:37 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 1
Ohhhhh! Thanks!
26th Apr 2018, 7:38 PM
Charles W Hsu
Charles W Hsu - avatar