元组是多个值组成的复合值类型
import Foundation
let money = (100,"EUR")
let currency = money.1
let amout = money.0
print("I have \(amout) \(currency) ") //I have 100 EUR
let money2 = (amout: 100,currency: "EUR")
let currency2 = money2.currency
let amout2 = money2.amout
print("I have \(amout2) \(currency2) ")// I have 100 EUR
func format(input: (Int,String)) -> String {
return "I have \(input.0) \(input.1) in my wallet"
}
print(format(money)) // This prints "I have 100 USD in my wallet"