for %<numerical variable>=<number> to <number> (step <increment>)
:icommands in loopj

This is essentially the same as a BASIC loop. The for loop starts at the first number, and then increments it (or decrements it) by the step value until it has gone beyond (or below, in case of a negative step) the second number. The step value is 1 by default.

If you use methods like goto or select inside a for loop, you leave the nscripter stack in an inconsistent and easily-crashable state, so please do not do this. Do your part to eradicate spaghetti code today!

All commands in the loop between the FOR and the NEXT will be executed. If you want to prematurely break out of the loop, issue a BREAK command. You can also use gosub commands to no ill effect within a loop. In other words, it is highly recommend to compartmentalize what is *inside* a loop from what is *outside* of it.