What is a branch loop

Branches and loops

Loops are formed using the keywords,,,,,, and.

Counting loops

and form the beginning and end of the loop body. The head of the loop is introduced by, followed by the loop variable. The start value of the variable is after, the end value after, the increment can be specified after. The default is to count up by one.

So the basic shape of the loop is:

    The loop variable can only have the data type integrity or float accept. No algebraic expressions are possible.

    Alternatively, the loop variable can accept all values ​​in a list. The keyword is used for this, i.e.:

    In this case, any data type can be in the list.

    If the loop variable has a value from previous assignments, the for loop will still execute as expected. Then the value of the variable is changed by the for loop.

    All key words except and can be omitted. The following standard values ​​are added if the corresponding keywords are missing:

    keyworddefault

    If the keyword is omitted, the loop has no loop variable. In this way it is easy to create endless loops or loops without sense!

    while loops (repellent loops)

    In addition to the ones described so far, there is the keyword followed by a condition. The statements in the loop body are executed if the condition yields the value. If the condition yields the value, the loop breaks off. This type of loop becomes repellent bow called.

    In its general form, a loop is:

    The keywords of the loop can be combined with. This results in an additional termination condition for the loop.