for Statement C Style


Uses C-style iteration to control the number of times a statement executes.


for([init-stmt]; [boolean-expr]; [incr-stmt])
Variable Description
init-stmt Optional: An assignment or function call that initializes the index of the loop.
boolean-expr Optional: An assignment or function call that tests the termination condition of the loop.
incr-stmt Optional: A relational expression specifying the loop increment. If you omit boolean-expr, the relational expression is interpreted as permanently TRUE.
statements Code to be executed in the loop; either a single statement or a series of statements.


You can omit one, two, or all three of the expressions, but you cannot omit the semicolons.


[-] testcase ForCExample()
	[ ] INTEGER i
	[-] for(i = 1; i < 5; ++i)
		[ ] Print(i)
	[ ] // This script prints:
	[ ] // 1
	[ ] // 2
	[ ] // 3
	[ ] // 4