What do the double arrows indicate in the return type of the last function here?
Are they used to indicate two different return values?
If so, how do you kno
The -> (Int) -> Int
in
func chooseStepFunction(backwards: Bool) -> (Int) -> Int{
return backwards ? stepBackward: stepForward
}
means that the function returns a function that takes an Int
as a parameter, and also returns an Int
.
You can see it as func chooseStepFunction(backwards: Bool) -> [ (Int) -> Int ] {