Show TOC

for StatementLocate this document in the navigation structure

Use

Purpose

Repeats a substitution in a for loop.

Syntax

for ( expression ; expression ; expression) statement end

Description

You can use the for statement just as in C or JavaScript. However, in contrast to C, you cannot list several expressions separated by commas.

Example

The use of the for loop can be illustrated by the following examples:

`for (j = 10; j > 0; j--)` <td> `end`

`for (j = 1; j <= array.dim ; j++)`
   array[`j`]=`array[j]`
 `end`

`for (a = "a"; a != "aaaa"; a = a & "a") a end`
         
More Information

For information on using for to code repeat loops, see repeat Statement.