随便学学

func sum(num1:Int,num2:Int,num3:Int) -> Int{

return num1 + num2 + num3;

}

sum(num1: 1, num2: 2, num3: 3)

func makeCoffee(coffeeName:String = "雀巢") -> String{

return "制作了一杯\(coffeeName)咖啡"

}

makeCoffee(coffeeName: "拿铁")

makeCoffee()

func sum2(num:Int...) -> Int {

var result = 0

for n in num {

result += n

}

return result;

}

sum2(num: 10,20,30)

var m = 30

var n = 20

func swapNum(m :inout  Int, n :inout Int){

let temp = m

m = n

n = temp

}

swapNum(m: &m, n: &n)

你可能感兴趣的:(随便学学)