10 times
while
LoopHere is the part of the program responsible for the loop:
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" );
Here is how it works in tedious detail. Look especially at steps 7, 8, and 9.
count
is assigned a 1.( count <= 3 )
is evaluated as true.count
is written out: count is 1count
is incremented by one, to 2.( count <= 3 )
is evaluated as true.count
is written out. count is 2count
is incremented by one, to 3.( count <= 3 )
is evaluated as true.count
is written out. count is 3count
is incremented by one, to 4.( count <= 3 )
is evaluated as FALSE.while
execute?