+ 1

What does the get.chomp do exactly

it doesn't explain very well i have no idea what it means

25th Jan 2020, 6:19 PM
Dillon Flannery
Dillon Flannery - avatar
2 Antworten
+ 2
Gets user input without last char like tab or linefeed
25th Jan 2020, 6:28 PM
Oma Falk
Oma Falk - avatar
0
"gets" stands for "get string". The user must type some text, then hit Enter when done. The Enter keypress is included in the user string as a newline (\n) character. e.g. "hello\n" "chomp" removes that final \n char. Lookup "Ruby chomp" to learn how to remove other chars from the end of a string.
27th Jan 2020, 1:12 PM
eddroid