Last active
December 2, 2019 13:54
-
-
Save maciej/3178356ae94d4e8dc8e4dbbf36ad1773 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
package main | |
import "fmt" | |
func defer1() { | |
var s = "Hello!" | |
defer fmt.Println(s) | |
s = "Ahoy!" | |
} | |
func defer2() { | |
var s = "Hello!" | |
defer func() { fmt.Println(s) }() | |
s = "Ahoy!" | |
} | |
func main() { | |
defer1() | |
defer2() | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment