Topic: Small question

Hey, What is the  Difference between puts and print ?

Re: Small question

NEVER use puts in a rails app it sends output to the console which is fine in ruby but not on a website. print is fine as far as I know

What you want and what you need are too often not the same thing!
When your head is hurting from trying to solve a problem, stop standing on it. When you are the right way up you will see the problem differently and you just might find the solution.
(Quote by me 15th July 2009)

Re: Small question

The difference between puts and print has to do with how ruby formats it.

Puts has a newline (\n) at the end so one puts followed by another puts will but on different lines, print does not have a new line at the end.

There is a difference, it's small but it's there, it's like saying "" and '' have no difference but they have a VERY significant difference especially if your using #{} to print out variales.

Re: Small question

Thank you all for your reply:-)

Last edited by jimmybrion (2013-04-13 05:35:39)