package main
import "fmt"
func main() {
defer fmt.Println("Defer printing")
fmt.Println("a")
fmt.Println("b")
fmt.Println("c")
fmt.Println("d")
}
Outputs:
a
b
c
d
Defer printing
package main
import "fmt"
func main() {
defer fmt.Println("Defer printing")
fmt.Println("a")
fmt.Println("b")
fmt.Println("c")
fmt.Println("d")
}
Outputs:
a
b
c
d
Defer printing
本文标题:Go defer
本文链接:https://www.haomeiwen.com/subject/nyfouqtx.html
网友评论