Swift code to print the messages in same line. When you use the print function it will add a new line at the end, so the next message will be printed on the next line. This code will show you how you can print messages in the same line.
print("Hello this is Swift 2.0 !") print("Swift is ", terminator : "") print("Awesome !")
Hello this is Swift 2.0 ! Swift is Awesome !
Inorder to print messages in the same line. We have to specify the terminator parameter in the print function. It can be done in this syntax
In the first print function we haven't specified the terminator, so the new line escape sequence
\n will be appened to the end.
In the second print function we have specified the terminator which makes the
Awesome ! message in the next print function to get printed on the same line.