Ruby: What's the difference between STDIN.gets() and gets.chomp()?

Viewed 15570

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())

and

myNumb = Integer(gets.chomp()) 
3 Answers
Related