FOR Loops

<< Click to Display Table of Contents >>

Navigation:  Project > Scripts > ST language > Operators and Expressions in STL > Iteration with Repeating Loops >

FOR Loops

Previous pageReturn to chapter overviewNext page

The first loop is the FOR loop and is used to repeat a specific number of times.This is the syntax of FOR loops in Structured Text for TeslaSCADA2:

for (count = initial_value; condition; increment){

<statement>;

}

Keyword that starts the FOR loop statement.

count = initial_value

This assignment operation is where you set the initial value you want to count from. Count is the variable name and initial_value is the value you want to start counting from.

;

Semicolon before condition statement.

condition of the loop’s continuation.

;

Semicolon before incremental statement.

increment statement.

Usually used to increment initial value - count in this case. Then you place statements between {} that will execute during loops.