Created
September 1, 2013 14:58
-
-
Save metasansana/6404950 to your computer and use it in GitHub Desktop.
Go language closure.
This file contains 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 outer (outerArg int) func(int) { //this could also be a custom type | |
return func (innerArg int) int { // closure func | |
return outerArg+innerArg; | |
} | |
} | |
//Usage | |
var result = outer(1)(2); // result will be equal to 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment