FOR ... NEXT

Syntax:

for <byte or int variable> = <byte or int expression1> to <byte or int expression2>
[statements...]
next <variable>

The FOR … NEXT construct will assign the result of expression1 to the given variable, then iterate the variable until it reaches the value of expression2, executing the commands between FOR and NEXT as many times as necessary. FOR … NEXT constructs can be nested.

Note #1: the value of expression2 is evaluated only once, before starting the loop.

Note #2: it is not possible to omit the variable name after the NEXT statement.

Note #3: the runtime library will not check the consistency of your FOR … NEXT blocks. If there is a NEXT without FOR, for example, the program will likely break.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies

Discussion

Enter your comment. Wiki syntax is allowed: