对元组进行解析
func thrid<A,B,C>(x:(A,B,C))->C{
switch x {
case (_,_,let x3):
return x3
}
}
thrid((1,1.0,"3"))
//输出 “3”
third (a, b, c) = c
third (1,1.0,"3")
--输出 “3”
not函数
enum Bool1{
case True1
case False1
}
func not(x:Bool1) -> Bool1 {
switch x {
case .True1:
return .False1
case .False1:
return .True1
}
}
data Bool1 = True1|False1
not1 :: Bool1 -> Bool1
not1 True1 = False1
not1 False1 = True1