Special Statements
Goto statement
In Go, goto statement is used to alter the normal execution of a program and transfer control to a labeled statement in the same program. The label is an identifier, it can be any plain text and can be set anywhere in the Go program above or below to goto statement.
Break Statement
In Go, break statement gives you way to break or terminate the execution of innermost “for”, “switch”, or “select” statement that containing it, and transfers the execution to the next statement following it. It is similar to many other languages.
Labeled Break Statement
The standard unlabeled break statement is used to terminates the nearest enclosing statement. The labeled break statement uses a label after the break statement.
Continue Statement
The continue statement gives you way to skip over the current iteration of any loop. It is similar to many other languages.
Labeled Continue Statement
The standard unlabeled continue statement is used to skip the current iteration of nearest enclosing loop. The labeled continue statement uses a label after the continue statement.
Defer Statement
A defer statement defers the execution of a function until the surrounding function returns.
Deferred function calls are pushed onto a stack. When a function returns, its deferred calls are executed in last-in-first-out order.
Last updated