The use of println
and print
in Swift both print to the console. But the only difference between them seems to be that println
returns to the next line whereas print
will not.
For example:
println("hello world")
println("another world")
will output the following two lines:
hello world
another world
while:
print("hello")
print("world")
outputs only one line:
helloworld
The print
seems to be more like the traditional printf
in C. The Swift documentation states that println
is the equivalent to NSLog
but what's the purpose of print
, is there any reason to use it other than not returning to the next line?