Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save RYO-mini/bff7ea46e131e70eae66 to your computer and use it in GitHub Desktop.
Save RYO-mini/bff7ea46e131e70eae66 to your computer and use it in GitHub Desktop.
func sampleNest() -> (Void->Int) {
var value = 3
func numIncrement() -> Int {
return value + 1
}
return numIncrement
}
let output = sampleNest()
println( output() )
// 出力
// 4
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