package main

import "fmt"

func main() {
	defer test()

	fmt.Println("hello")
}

func test(){
	v := 10
	fmt.Println(v)
}

deffer 스택

package main

import "fmt"

func main() {
	fmt.Println("counting")

	for i := 0; i < 10; i++ {
		defer fmt.Println(i)
	}

	fmt.Println("done")
}

Untitled