Last active
August 29, 2015 14:10
-
-
Save RYO-mini/bff7ea46e131e70eae66 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func sampleNest() -> (Void->Int) { | |
var value = 3 | |
func numIncrement() -> Int { | |
return value + 1 | |
} | |
return numIncrement | |
} | |
let output = sampleNest() | |
println( output() ) | |
// 出力 | |
// 4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func sampleNest(val: Int, fncIncre: Int->Int) -> Int { | |
var value = fncIncre(val) | |
return value | |
} | |
func numIncrement(num: Int) -> Int { | |
return num + 1 | |
} | |
sampleNest(5, numIncrement) | |
//出力 | |
//6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment