Puts and Prints Confusion


#1


Hey all! So I'm a little confused on the difference between puts and prints. I understand that print is used to print a message on the screen, but when I get to puts, I'm find myself in a daze as I don't really understand what the lesson is trying to tell me. Can someone please explain a little bit more?



#2

puts - it prints and also adds a newline character
print - it prints but does not add any character

for ex..

puts "myname"
puts "hisname"

# will print..
myname
hisname

but when you use print..

print "myname"
print "hisname"

# it will print this..
mynamehisname

also check out this article...


#3

Oh! This makes much more sense. Thank you so much for replying!


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.