331319 (3) [Avatar] Offline
I have attached the example to show what I mean. \n appears at the end of anything I write in the text bracket.
Tanmay Bakshi (1) [Avatar] Offline
Hi - it's because the playground does not support multi-line text in the output pane. Since it cannot display another line, it displays "\n" in the output pane, which you are viewing. However, if you were to run this on a real iOS/macOS app, it will not show the "\n".

Also, if you go to the menu: "View -> Debug Area -> Show Debug Area (Command-Shift-Y)", it will toggle the "Debug Area" of the playground, as a horizontal pane on the bottom of your screen.

You can see the result of your "print" statements there, with multi-line support. In this area, you will see that the "\n" gets translated into a new line, since "\n" actually means "New Line".

I'll give you an example. If you enter the following command:
print("Hello, One\nTwo\nThree!")

Then, in the output pane, you see:
"Hello, One\nTwo\nThree!\n"
But in the Debug Area (again, at the bottom of the screen), you should see:
Hello, One

Also, all
statements in Swift (2 and later), have a new line at the end, which shows up in the Playground's output pane.

I hope this answers your question. If not, feel free to write back on the forum, and if you have any more questions, please create another thread.

- Tanmay Bakshi
P.S. Sorry for the late reply!
331319 (3) [Avatar] Offline
Thanks for the detailed reply, makes a lot more sense now!