Help with .chomp


Hello everyone,

I am curious to know more about the .chomp method. I wrote a bit of code:

name = gets.chomp

print "Well then, good day #{name.capitalize}."

When I run the program in the control prompt and enter a name, say Eric, it returns:
Well then, good day Eric.

But when I remove the .chomp portion:

name = gets

print "Well then, good day #{name.capitalize}."

The program returns:
Well then, good day Eric

I understand that the .chomp method removes the extra line, but why when I remove .chomp, it places the period on the next line?

Thanks in advance.


You're answering your own question


Still confused, but I'm sure I'll eventually figure it out.
Thanks ionatan.