00:00
-02:22

RFS: puts vs print Method - 017

The difference between puts and print is more subtle. Let's take a look

puts

We're familiar with puts it puts out everything and converts it to string

puts 'something'puts 'another'somethinganother

If we run this ruby script it will simply output the stings in 2 separate lines.

print

Print is a much more primitive it doesn't add a new line to the end of the output.

print 'something'print 'else'somethingelse%

That's the difference between puts and print, hope you found this useful!