Swift Tutorial - Tutorialspoint

(backadmin) #1

return .add


case 1 :


return .sub


case 2 :


return .mult


case 3 :


return .div


default:


return .anything


}


}


}


func result(numb: [Int]) {


for i in numb {


switch i.print {


case .add:


println(" 10 ")


case .sub:


println(" 20 ")


case .mult:


println(" 30 ")


case .div:


println(" 40 ")


default:


println(" 50 ")


}


}


}


result([ 0 , 1 , 2 , 3 , 4 , 7 ])

Free download pdf