• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 6. Core Syntax > do…while

do…while

JavaScript 1.0+ , ECMAScript 1.0, JScript 3.0+ Nav2+, NES3+, IE 4+, Opera 3+ Syntax

do{
  statement;
}while(expression);

Description

The do…while loop always executes the loop once before evaluating the expression for the first time. Once the loop has executed for the first time, the expression, in parenthesis, is evaluated. If true, the loop is executed again. When the expression evaluates to false, the next line of code following the while structure is executed. A statement must be included in the loop that modifies a variable in the expression to prevent an infinite loop. Also, notice that a semicolon (;) must be placed after the right parenthesis.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint