for (repeat with counter variable)


for counter initvalue finalvalue [step]


Can be single line:

for(counter initvalue finalvalue [step]) statements



counter - counter variable. Type - int, long, lpstr or pointer.

initvalue - initial counter value. Type - type of counter.

finalvalue - final counter value. Type - type of counter.

step - value to add to counter after each loop. Type - int. Default: 1.



Simple description:

Repeatedly executes statements, after each loop adding 1 (or step) to counter variable.


Complete description:

Assigns initvalue to counter, and, while counter < finalvalue, repeatedly executes statements. After each loop adds step to counter. If step is negative, executes statements while counter > finalvalue.


Use break to exit loop. Use continue to skip following statements.



If you don't need counter variable, use rep.


See also: foreach



lpstr s = "abcd.ef"
int i
int j = len(s)
for i 0 j
	out i
	if s[i] = '.'

for(i 0 j) out i; if(s[i] = '.') break