"Go defer"의 두 판 사이의 차이

(새 문서: ==개요== ;Go defer <source lang='go' run> package main import "fmt" func main() { defer fmt.Println("world") fmt.Println("hello") } </source> ==참고== * https://tour.golang...)
 
1번째 줄: 1번째 줄:
==개요==
==개요==
;Go defer
;Go defer
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.


<source lang='go' run>
<source lang='go' run>

2020년 9월 24일 (목) 18:33 판

1 개요

Go defer

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.

package main

import "fmt"

func main() {
	defer fmt.Println("world")

	fmt.Println("hello")
}

2 참고

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}