> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Statements

> Statements in the FlexiLayout language: separating statements, compound blocks, conditional if-then-else branching, and for loops with break and continue.

## Statement separators

Statements are separated by a semicolon (`;`).

## Compound statements

One or more statements can be enclosed in curly braces to form a compound statement. Compound statements are commonly called "blocks" (not to be confused with FlexiLayout blocks).

## Conditional statements

In any section intended for entering code, you can use conditional `if` statements.

The `if` statement controls conditional branching. The body of an `if` statement is executed if the value of the expression is `true`. The syntax for the `if` statement has two forms:

```text theme={null}
selection-statement:
    if ( expression ) then statement
    if ( expression ) then statement else statement
```

In both forms of the `if` statement, the expressions are evaluated.

In the first form of the syntax, if `expression` is `true`, `statement` is executed. If `expression` is `false`, `statement` is ignored. In the second form of the syntax, which uses `else`, the second `statement` is executed if `expression` is `false`.

## Iteration statements

In any section intended for entering code, you can use iteration `for` statements.

The `for` statement controls loops. The loop is executed while the value of the expression is `true`. The syntax has one form:

```text theme={null}
iteration-statement:
    for <var-name> from <from-expr> to <to-expr> [ step <step-expr>]
    <statement>
```

The `<var-name>` counter name is required. This name must be different from the names of variables declared earlier. The scope of the counter is the body of the loop. Within the loop, you cannot change the counter value or declare a variable with the same name as the counter.

The initial `<from-expr>` and final `<to-expr>` counter values are evaluated before the first iteration of the loop. Then they are treated as integer constants to avoid endless loops.

The `step` parameter is optional. If the `step` value is not specified, the step is considered 1. The step value, along with the initial and final counter values, is evaluated once at the beginning of the loop.

The sign of the step determines the iteration condition:

* For positive step values, the condition `<var-name> ≤ <to-expr>` must be met.
* For negative step values, the condition `<var-name> ≥ <to-expr>` must be met.

The step value cannot be zero. Otherwise, an error message appears.

The `<statement>` can be a single statement or a block (compound statement) enclosed in curly braces.

You can also use the following statements inside the loop:

* `break` – Breaks the loop.
* `continue` – Goes to the next iteration of the loop.
