Last active
October 12, 2016 21:04
-
-
Save mlowicki/1c6412339d619f56081d67cc165c76e7 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
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