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 trialJuan Juarez Baldizon
Courses Plus Student 3,352 Pointscontent after entering print command has \n attached to it, how to remove this?
I'm trying the for-in loop for the lesson, I'm aware of the change to swift where println has become just print, I enter print(todo[0]) and it returns the content with a \n for some reason, help appreciated.
1 Answer
Anonymous User
Courses Plus Student 2,204 PointsThe /n is part of the reason they've changed println to print
print used to just print it all on one line, and println would put the print statement on a new line
the /n just means that when you type print, it automatically puts whatever is assigned to it on a new line, which made println useless
Juan Juarez Baldizon
Courses Plus Student 3,352 PointsJuan Juarez Baldizon
Courses Plus Student 3,352 PointsSo does this mean the \n won't be seen by the user even though I can see it on xcode? Thanks for the reply
Anonymous User
Courses Plus Student 2,204 PointsAnonymous User
Courses Plus Student 2,204 Pointsyes, its only seen in the side bar, not in the output where everything prints.