Home » Go Break

Go Break Statement

A break statement is used to break out of the innermost structure in which it occurs. It can be used in for-loop (counter, condition,etc.), and also in a switch. Execution is continued after the ending } of that structure.

Syntax:-

Go Break Statement Example:

Output:

Value of a is 1  Value of a is 2  Value of a is 3  Value of a is 4  Value of a is 5  

Break statement can also be applied in the inner loop, and the control flow break out to the outer loop.

Go Break Statement with Inner Loop:

Output:

1 1  1 2  1 3  2 1  3 1  3 2  3 3  

Next TopicGo Continue

You may also like