+ 5
Can somebody tell me how to store user input into a variable so you can do anything with it for example math???
2 Respuestas
+ 10
Use this for strings:
name = gets
# or use
name =gets.chomp
gets on it's own returns a \n character, and chomp removes it. When dealing with integers strictly use:
digits = gets.to_i
That will convert the users string into an integer.
+ 2
ok thank you