package main import ( "fmt" ) func f() (result int) { defer func() { // result is accessed after it was set to 6 by the return statement result *= 7 }() return 6 } func main() { assert(f() == 42) fmt.Println(f()) for i := 0; i <= 3; i++ { defer fmt.Println(i) } }