Entering content frame

Background documentation for Statement Locate the document in its SAP Library structure

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.

Examples

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`

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

Leaving content frame