Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial

Brendan Whiting
Front End Web Development Techdegree Graduate 84,738 Pointswhat's the difference between println and print? Both are used one after the other and seem to do the same thing
Both are used one after the other and seem to do the same thing
2 Answers

Fred Sites
11,151 Pointsprintln("Sample String")
will print the text string but will then move the curser to a new line. print("Sample String")
will also print the line but will not move the curser to the next line. This results in all subsequent print commands being printed on the one line. You'll find println is used much more throughout the course.

mohitbhatia
Courses Plus Student 5,153 PointsThe prime distinction to be made between the print and println() functions is that the println function adds a line break after printing out the output statement whereas the print command will not do so.
Consider:
print("Hello")
print("Hello Again!!!")
The console output in the assistant editor would be:
HelloHelloAgain!!!
The same statements with println used in place of the print commands would yield the following output:
Hello HelloAgain!!!
Brendan Whiting
Front End Web Development Techdegree Graduate 84,738 PointsBrendan Whiting
Front End Web Development Techdegree Graduate 84,738 PointsI understand. I think part of the confusion is that in the "playground" section it adds a new line to both anyway, the only difference is in the output section.