while Loops

 

Python

Java

 

Form:

 

while <Boolean expression>:

    <statement>

    É

    <statement>

 

The statements in the loop body are marked by indentation.

 

 

Form:

 

while (<Boolean expression>){

    <statement>

    É

    <statement>

}

 

The statements in the loop body are marked by curly braces ({}).  When there is just one statement in the loop body, the braces may be omitted.

 

The Boolean expression is enclosed in parentheses.

 

 

Previous

Index

Next