We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3d551ff commit 65ecbc1Copy full SHA for 65ecbc1
_content/tour/flowcontrol.article
@@ -153,7 +153,7 @@ This construct can be a clean way to write long if-then-else chains.
153
154
* Defer
155
156
-A defer statement defers the execution of a function until the surrounding
+A `defer` statement defers the execution of a function until the surrounding
157
function returns.
158
159
The deferred call's arguments are evaluated immediately, but the function call
_content/tour/flowcontrol/defer.go
@@ -4,8 +4,13 @@ package main
4
5
import "fmt"
6
7
+func helper() string {
8
+ fmt.Println("helper")
9
+ return "world"
10
+}
11
+
12
func main() {
- defer fmt.Println("world")
13
+ defer fmt.Println(helper())
14
15
fmt.Println("hello")
16
}
0 commit comments