Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you do println() in swift 2 [duplicate]

Tags:

ios

swift

swift2

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

like image 572
TZE1000 Avatar asked Jul 04 '15 04:07

TZE1000


Video Answer


2 Answers

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.

like image 155
Ashish Kakkad Avatar answered Oct 08 '22 04:10

Ashish Kakkad


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()

like image 43
Joonwoo Kim Avatar answered Oct 08 '22 06:10

Joonwoo Kim