Skip to content

Instantly share code, notes, and snippets.

@mlowicki
Last active October 12, 2016 21:04
Show Gist options
  • Save mlowicki/1c6412339d619f56081d67cc165c76e7 to your computer and use it in GitHub Desktop.
Save mlowicki/1c6412339d619f56081d67cc165c76e7 to your computer and use it in GitHub Desktop.
import "fmt"
func f() int {
n := 0
defer func() {
n++
}()
return n
}
func g() (n int) {
defer func() {
n++
}()
return n
}
func main() {
fmt.Printf("f() == %d\n", f())
fmt.Printf("g() == %d\n", g())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment