Yes.
while
statement
Here is the while
statement, again:
while ( condition ) loop body // a statement or block statement statement after the loop
Some notes on the semantics:
while
statement is finished, at least for now.Here is the while loop from the example program:
int count = 1; // start count out at one while ( count <= 3) // loop while count is <= 3 { System.out.println( "count is:" + count ); count = count + 1; // add one to count } System.out.println( "Done with the loop" ); // statement after the loop
This loop makes use of the variable count
.
It is started out at 1, then incremented by one until the condition is false.
Then the statement after the loop is executed.