Statements and declarations

do...while statement

Try the free JavaScript compiler

Enters the body before testing for continuation. A normal first entry executes the body at least once; use when a required first attempt is part of the contract.

Formal Syntax & Structure

javascript syntaxjavascript
do { body } while (test);

Working Example

Example Snippetjavascript
let n = 0; do { n++; } while (false); console.log(n);
JavaScript Reference