[Swift] function 1-1

iOS 2015. 7. 23. 23:34
반응형

import UIKit


func sayHello() {

    println("hello")

}


// 1. external parameter (nameOfPerson name: String)

// 2. internal parameter (name: String)

// 2. hash prefix (#name: String)

func sayHelloTo(#name: String) ->String {

    println("Hello \(name)")

    return "Well, Hello to you to \(name)!"

}


sayHello()


println(sayHelloTo(name: "Jack"))



반응형

'iOS' 카테고리의 다른 글

[Swift] function 1-3  (0) 2015.07.23
[Swift] function 1-2  (0) 2015.07.23
Loops, Switch Statements, and Ranges in Swift  (0) 2015.07.23
[swift] card  (0) 2015.07.23
[swift] protocol adjusted class, structure and enum  (0) 2015.07.23
: