Created
February 27, 2023 03:43
-
-
Save ehfeng/4839fbe7022fcfd6ca8725389263df39 to your computer and use it in GitHub Desktop.
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 main() { | |
m := map[string]int{ | |
"one": 1, | |
} | |
defer func() { | |
fmt.Println("deferred first", m) | |
}() | |
// a function will evaluate upon defer | |
// an expression evaluates immediately | |
defer fmt.Println("deferred second", m) | |
m = map[string]int{ | |
"one": 2, | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment