Ruby: What's the difference between STDIN.gets() and gets.chomp()?
What's the difference between STDIN.gets() and gets.chomp() in Ruby? Aren't they both retrieving raw input from the user?
side question: If I want to convert their input into an integer, do I do
myNumb = Integer(STDIN.gets())
myNumb = Integer(gets.chomp())
Easiest way to do what you describe here is Integer(gets), since Integer() ignores the trailing newline, so chomp is unnecessary. There's also no need explicitly specify STDIN as the receiver, as that's what Kernel#gets will do if there are no arguments to the script.
gets is actually Kernel#gets. It reads from files passed as arguments or, if no arguments are present, reads from standard input. If you want to read only from standard input, then you should be more explicit about it.
As for the conversion, I normally use String#to_i. It handles newlines just fine.