1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
Flow Control Statements
^^^^^^^^^^^^^^^^^^^^^^^
.. crowbar:element:: FlowControlStatement <- ContinueStatement / BreakStatement / ReturnStatement
.. crowbar:element:: ContinueStatement <- 'continue' ';'
Compile-time Behavior:
Only valid inside a :crowbar:ref:`WhileStatement`, :crowbar:ref:`DoWhileStatement`, or :crowbar:ref:`ForStatement` block.
Runtime Behavior:
When a continue statement is executed, the innermost loop statement (while, do-while, or for) that contains the continue statement skips the remainder of the execution of its block.
For a while or do-while loop, this means skipping to the condition.
For a for loop, this means skipping to the update assignments.
.. crowbar:element:: BreakStatement <- 'break' ';'
Compile-time Behavior:
Only valid inside a :crowbar:ref:`WhileStatement`, :crowbar:ref:`DoWhileStatement`, or :crowbar:ref:`ForStatement` block.
Runtime Behavior:
When a break statement is executed, the innermost loop statement (while, do-while, or for) that contains the break statement ends entirely, skipping any remaining statements, condition tests, or updates.
.. crowbar:element:: ReturnStatement <- 'return' Expression? ';'
Compile-time Behavior:
The expression provided must have a type matching the return type of the containing function.
If the function has a return type of ``void``, the expression must be omitted.
Runtime Behavior:
When a return statement with an expression is executed, the expression is evaluated, and the containing function returns with the value obtained from this evaluation.
When a return statement with no expression is executed, the containing function returns.
|