Ruby again!! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 10

Ruby again!!

what is the difference between puts and print?! i see when i learning ruby that both of them used to display the results of evaluating ruby code. but i think it is impossible to use them in same purpose.. is there any differnet?! *additional tags

23rd Feb 2018, 5:56 AM
Baraa AB
Baraa AB - avatar
2 Answers
+ 6
Your title there!!! Puts is like(not the same) print but it adds a new line character(\n) after your text. Print just prints text without adding a new line. Puts "look! The text after this will have a new line character", "on next line" Print "no new line after this text", "on same line"
23rd Feb 2018, 6:42 AM
Lord Krishna
Lord Krishna - avatar
+ 4
thanks my friend <3 @Lord
28th Feb 2018, 8:10 PM
Baraa AB
Baraa AB - avatar