Friday, March 6, 2009

Difference between Puts and Print in Ruby

The difference between Puts and Print in ruby is, Puts appends a new line if it doesn't have at the end, while Print doesn't. Print outputs only what we have provided
print "Hello World", " by print\n"
puts "Hello World", " by puts"

Hello World by print
Hello World
by puts

Happy Programming

No comments:

Post a Comment