I cant seem to find out how to do println()
in Swift 2.
I tried doing println(helloworld)
That doesn't work
helloworld is a variable
Join Stack Overflow to learn, share knowledge, and build your career.
it's print("hello world")
. it's changed in swift 2.0 and you need to see Apple's website. put print()
instead of println()
No More println()
As per apple documentation :
In Swift 2.0 there is
print("Hello")
for the new line you can set flag
print("Hello", appendNewline: false)
Declaration
func print(_ value: T, appendNewline appendNewline: Bool)
Discussion
The textual representation is obtained from the value using its protocol conformances, in the following order of preference: Streamable, CustomStringConvertible, CustomDebugStringConvertible. If none of these conformances are found, a default text representation is constructed in an implementation-defined way, based on the type kind and structure.
Use quotation marks:
println("helloworld")
and in swift 2.0, use print():
print("helloworld")
Using Xcode 7.0 Beta 6, the solution on my end, including getting rid of the annoying new line character:
println("Hello world")
in Xcode 7, the error message "'println' has been renamed to print" immediately pops up, together with a "Fix it: replace 'println' by 'print'" suggestion. – Martin R Jul 4 '15 at 9:20