xxxxxxxxxx
A defer statement defers the execution of a function until the surrounding function returns.
The deferred call's arguments are evaluated immediately, but the function call is not executed until the surrounding function returns.
xxxxxxxxxx
package main
import "fmt"
func main() {
// defer the execution of Println() function
defer fmt.Println("Three")
fmt.Println("One")
fmt.Println("Two")
}
xxxxxxxxxx
The deferred call's arguments are evaluated immediately,
but the function call is not executed until the surrounding function returns.