package main import ( "fmt2" ) type Mutex struct { i int } func (m *Mutex) Lock() { m.i += 85 assert(m.i == 85) } func test2() { var m Mutex defer m.Lock() } 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) fmt2.Println(f()) for i := 0; i <= 3; i++ { defer fmt2.Println(i) } test2() }