mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-12 07:02:11 +08:00
18 lines
297 B
Go
18 lines
297 B
Go
package main
|
|
|
|
import "fmt"
|
|
|
|
func main() {
|
|
Function1()
|
|
}
|
|
|
|
func Function1() {
|
|
fmt.Printf("In Function1 at the top\n")
|
|
defer Function2()
|
|
fmt.Printf("In Function1 at the bottom!\n")
|
|
}
|
|
|
|
func Function2() {
|
|
fmt.Printf("Function2: Deferred until the end of the calling function!")
|
|
}
|