Skip to content

Instantly share code, notes, and snippets.

@AntonStoeckl
Created February 1, 2022 09:53
Show Gist options
  • Save AntonStoeckl/43d33e7936f0bceb02f99efa6707ba14 to your computer and use it in GitHub Desktop.
Save AntonStoeckl/43d33e7936f0bceb02f99efa6707ba14 to your computer and use it in GitHub Desktop.
Example for blog post: Go bits: Magic with functions
package closures
// IsBiggerThan returns a closure function that is parametrized with the
// first parameter
func IsBiggerThan(first int) func(second int) bool {
isBigger := func(second int) bool {
return second > first
}
return isBigger
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment