Skip to content

For to do loop

Description

This statement executes a loop a specified number of times.

Syntax

For <Variable> = <Expression> to <Expression> do
    <Statements>
Loop

Sample

Dim iTotal, iCount

For iCount = 0 to 9 do
    Let iTotal = iTotal + iCount
Loop

Return iTotal

Notes

  • Variable can be a local or a global variable or a parameter.
  • The start and end values are evaluated once. The variable is then initialized to the start value and evaluated for each iteration until it reaches the end value.