jjzjj

stepBackward

全部标签

ios - Swift 解释中作为返回类型的函数类型

我目前正在阅读Apple的Swift编程手册,书中有一个使用函数类型作为返回类型的示例。//UsingafunctiontypeasthereturntypeofanotherfunctionfuncstepForward(input:Int)->Int{returninput+1}funcstepBackward(input:Int)->Int{returninput-1}funcchooseStepFunction(backwards:Bool)->(Int)->Int{returnbackwards?stepBackward:stepForward}varcurrentValue