Data Sheet

dScript
dScript User Manual v2.15
for, next
The for/next commands are used to execute a set of instruction a specified number of times.
The syntax is:
for <variable> = start to end
statements
next
An example:
for X = 1 to 10 ; X counts up each loop
A = A + 1
next
If end is greater than start, the count will increment by one each loop. If the start is greater
than end the count will decrement by one each loop;
for X = 10 to 1 ; X counts down each loop
A = A + 1
next
for, next loops may be nested like this:
for X = 1 to 10 ; outer loop
for Y = 1 to 10 ; inner loop
A = A + 1 ; A gets incremented 100 times (10 loops of 10)
... more statements ...
next
next
Copyright © 2016, Devantech Ltd.
All rights reserved.
www.robot-electronics.co.uk
26