๐ŸŽ iOS/Swift

[Swift] ๊ธฐ๋ณธ ํ•จ์ˆ˜ function

// ๋ฐ˜ํ™˜๊ฐ’ O
func sum(a: Int, b: Int) -> Int {
    return a+b
}

// ๋ฐ˜ํ™˜๊ฐ’ X
func printMyName(name: String) -> Void{
    print(name)
}

// ๋งค๊ฐœ๋ณ€์ˆ˜ X
func maximumIntegerValue() -> Int{
    return Int.max
}

// ๋ฐ˜ํ™˜๊ฐ’ X ๋งค๊ฐœ๋ณ€์ˆ˜ X
func hello() -> Void{ print("hello") }


// ํ•จ์ˆ˜์˜ ํ˜ธ์ถœ
sum(a: 3, b:5) //8