Try run this code, and you will know what I am talking about
typealias IntegerFunction = Int -> ()func gamCounterSample() -> Int -> Void {func increment(i: Int){print("Integer passed in: \(i)")}return increment}func gameCounter() -> IntegerFunction {var counter = 0func increment(i : Int){counter += iprint("Counter value \(counter)")}return increment}let aCounter = gameCounter()aCounteraCounter(1)aCounter(1)
No comments:
Post a Comment