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

34 lines
917 B
Markdown

## Control Flow Structures in AVAP
In AVAP, control flow structures include conditional statements and loops, which allow you to control the flow of execution based on conditions and iterate over a range of values.
### If Statements
The syntax for an if statement in AVAP is:
```javascript
if (variable, variableValue, comparator, expression)
code to execute
else()
code to execute
end()
```
This structure checks if the condition (variable compared to variableValue with the given comparator) is true, and if so, executes the block of code.
### Loops
The syntax for a loop in AVAP is:
```javascript
startLoop(variable, from, to)
code to execute
endLoop()
```
This structure initiates a loop where the variable iterates from the 'from' value to the 'to' value, executing the code block for each iteration.