while Statement

Action

Executes a statement zero or more times under control of a test condition.

Syntax

while boolean-expr statement
Variable Description
boolean-expr A boolean expression that usually tests some state or relationship.
statement A single statement, or a series of statements.

Notes

A while statement executes zero or more times while boolean-expr is true. Each time statement executes, control returns to the evaluation of the boolean expression. If the value of the boolean expression is false initially, the while statement never executes and control passes to the next statement in the script.

Example

[-] testcase whileExample ()
	[ ] INTEGER i = 5
	[-] while (i > 0) 
		[ ] Print (i)
		[ ] i = i - 1 
	[ ] // This script prints:
	[ ] // 5
	[ ] // 4
	[ ] // 3
	[ ] // 2
	[ ] // 1