Title: Key Concept - While and do-while statements
Course: CPS 189: Java Certification - Review, Practice & Prepare (Development) > Section: (OLDstyle) Learning Modules

The while statement repeats execution of a block of code until a boolean expression is false.

●The while statement syntax:

The while statement

- It tests the boolean expression before execution of the block.
  - The block will execute zero or more times.

The do-while statement also repeats execution of a block of code until a boolean expression is false.

● The do-while statement syntax:

The do-while statement

- It tests the boolean expression after execution of the block.
- The block will execute one or more times.

For more information about while and do while statements:

- Click this link to view Oracles's documentation: The while and do-while statements.
- Level 1 Study Materials: Unit 3
- Level 1 Study Materials: Unit 4