assistance-engine/docs/developer.avapframework.com/chapter9_35.md

25 lines
1.2 KiB
Markdown

## Continue Statement
In AVAP, the continue statement is used to proceed with the next iteration of the closest enclosing loop. The syntax for the continue statement is as follows:
```javascript
continue
```
The continue statement can only syntactically occur nested within a `for` or `while` loop, but not within a function or class definition inside that loop.
When continue is used within a loop that is also handling exceptions with a `try` statement containing a `finally` clause, the `finally` clause is executed before the next iteration of the loop begins.
```javascript
for i in range(10):
try:
if i % 2 == 0:
continue
print(i)
finally:
print("In finally clause")
print("Loop ended")
```
In this example, the `continue` statement will skip the current iteration when `i` is even, but before moving to the next iteration, the `finally` clause will print "In finally clause." For odd numbers, the loop will print the number and then "In finally clause." After the loop finishes, "Loop ended" will be printed.