for ... next
Repeat a block of commands the requested number of times. Iteration is controlled through a specific variable value.
Syntax:
for
variable
=
start
to
finish
{step
increment
}
commands
{exit for}
{continue}
next
Iterate variable from
start
through
finish
, incrementing by
increment
. If step value is omitted, the variable will be incremented by one each cycle. The commands between
for
statement and
next
statement are executed each iteration through the loop. In optional way you can use the
end for
statement in place of
next
statement.
Example:
' Print the numbers from 1 to 10
for i = 1 to 10
print i
next
See also exit for, continue and step commands