11 lines
829 B
Markdown
11 lines
829 B
Markdown
## Break Statement
|
|
|
|
The break statement in AVAP is used to terminate the closest enclosing loop. Here is an overview of its behavior:
|
|
|
|
* Usage Context: The break statement can only occur within a for or while loop. It cannot be nested within a function or class definition inside that loop.
|
|
* Loop Termination: It terminates the closest enclosing loop and skips the optional else clause if the loop has one.
|
|
* Loop Control Target: If a for loop is terminated by break , the loop control target retains its current value.
|
|
* Interaction with try-finally: When break is executed within a try statement with a finally clause, the finally clause is executed before actually exiting the loop.
|
|
|
|
The break statement is essential for controlling loop execution, allowing for early exit from loops and proper handling of loop cleanup.
|