[Contents] [Previous] [Next] [Index]

do...while

Executes its statements until the test condition evaluates to false. Statement is executed at least once.

Implemented in

Navigator 2.0

Syntax

do 
   statement
while (condition);

Arguments

statement
Block of statements that is executed at least once and is re-executed each time the condition evaluates to true.

condition
Evaluated after each pass through the loop. If condition evaluates to true, the statements in the preceding block are re-executed. When condition evaluates to false, control passes to the statement following do while.

Example

In the following example, the do loop iterates at least once and reiterates until i is no longer less than 5.

do {
   i+=1
   document.write(i);
while (i<5);


[Contents] [Previous] [Next] [Index]

Last Updated: 10/31/97 12:29:59


Copyright © 1997 Netscape Communications Corporation


Casa de Bender