Top  >  Lycia reference  >  Querix 4GL  >  Statements  >  FOR

FOR

 

FOR statement specifies a loop, the statements within this loop are executed a definite number of times.

 

 

Element

Description

Counter

A variable of INTEGER or SMALLINT data type that serves as an index for the statement block.

TO Clause

A clause where the upper and lower limits for the counter are specified

STEP Clause

An optional clause specifying the size of one step

Logical Block

A block that must include at least one executable statement. It can also include the definition block

 

The statements in the Logical Block are executed the specified number of times, unless the execution of the FOR statement is terminated by the EXIT FOR statement. The FOR statement is typically used, when you know the upper limit of the iterations required. If you are not sure how many times the loop is to be repeated, it is advisable that you use the WHILE loop instead.