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!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
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 Respostas
+ 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