Puts and print command


The puts command show "nil" after printing a line i.e in the next line whereas in the print command 
"nil" after the text has been printed. why does this happen?


Neither is outputting nil
puts writes out a "\n" character (newline), print doesn't. The difference is therefore that there is one line more/less


Because puts ensures that the printed text ends in \n, while print does


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