User Tools

Site Tools


en:for

This is an old revision of the document!


For / Next (Statement)

Format

Description

The FOR and NEXT commands are used in conjunction to execute a command or group of commands a specified number of times. When the FOR command is first encountered, the variable is set to start_expression.
After each NEXT command, variable is incremented by 1 (the default), or by step_expression if the optional STEP is used, until the variable is greater than stop_expression for positive step values, or less than stop_expression for negative step values.

Example

for i = 1 to 10
	print i
next i

print "after the for " + i

displays

1
2
3
4
5
6
7
8
9
10
after the for 11

See Also

en/for.1471100440.txt.gz · Last modified: 2020/02/28 10:46 (external edit)