+ 5

Ruby: How can the user define the variable?

For example my code which don't work: https://code.sololearn.com/cQbsNT9Uh1N3/?ref=app

10th May 2017, 5:52 PM
Iwan
Iwan - avatar
3 Answers
+ 12
Use gets.to_i E.g. var = gets.to_i
10th May 2017, 6:00 PM
Hatsy Rei
Hatsy Rei - avatar
+ 9
You are welcomed. đŸȘ
10th May 2017, 6:09 PM
Hatsy Rei
Hatsy Rei - avatar
+ 7
Thanks
10th May 2017, 6:08 PM
Iwan
Iwan - avatar