Previous Topic: Iterative StatementsNext Topic: The do/while Loop Statement


The while loop Statement

The while loop has the following syntax:

while (Boolean_expression)
	statement

The while loop performs a sequence of statements as long as the Boolean expression tested at the start of the loop returns a True value. For example:

var n = 0
while (n < 10)
{	
   Process.square[n] = n * n
	n++
}