Difference between revisions of "Defer"
Jump to navigation
Jump to search
(Created page with "{{lc}} * https://go.dev/tour/flowcontrol/12 == See also == * {{Go}} Category:Go") |
|||
(6 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
* https://go.dev/tour/flowcontrol/12 | * https://go.dev/tour/flowcontrol/12 | ||
+ | |||
+ | == Example == | ||
+ | |||
+ | [[package main]] | ||
+ | [[import]] "fmt" | ||
+ | |||
+ | [[func]] main() { | ||
+ | defer fmt.Println("world") | ||
+ | |||
+ | fmt.Println("hello") | ||
+ | } | ||
== See also == | == See also == | ||
* {{Go}} | * {{Go}} | ||
+ | * {{flow control}} | ||
[[Category:Go]] | [[Category:Go]] |
Latest revision as of 15:58, 21 August 2022
Example[edit]
package main import "fmt" func main() { defer fmt.Println("world") fmt.Println("hello") }
See also[edit]
- Go, Gorutine:
go [ mod
|list
|fmt
,for
|build
|get
|version
|env | install | test
]go help
, Go template, Echo go web framework, Go packages, Blank identifier - Flow control,
if, for, while, defer
Advertising: