Chapter 3 : Output Statements



Output Statements

If you come from C, C++ background that you must be familiar with print and println statements.

print() function :






//
//  main.swift
//  Swift Tutorials 2014-15
//
//  Created by Code2care on 15/09/14.
//  Copyright (c) 2014 Code2care. All rights reserved.
//


print("Hello! ")
print("We are learning Swift Programming Language!")


Output :

Hello! We are learning Swift
Program ended with exit code: 0





println() function :






//
//  main.swift
//  Swift Tutorials 2014-15
//
//  Created by Code2care on 15/09/14.
//  Copyright (c) 2014 Code2care. All rights reserved.
//


println("Hello!")
println("We are learning Swift Programming Language!")


Output :

Hello!
We are learning Swift
Program ended with exit code: 0



Note : We do not need to add a semi-colon to the end of each line as in most of the programming languages.

Note : No imports are needed of print and println statements.