lecture-14.ppt

Download Report

Transcript lecture-14.ppt

The do-statement
The do-statement (1)
• The do-statement is different from the while-statement and
the for-statement in that:
• The do-statement makes the continuation test after executing
the statements in the body
The do-statement (2)
• The keyword do announces (to the Java compiler) that we
started an do-statement
• Following the keyword do, you can write (only) one statement
• The keyword while and a conditional clause ( LOOPCONTINUATION-CONDITION ) follow the body
Flow chart
Example (1)
Example (2)
Re-writing a do-statement using
a while-statement
Coordinate system of a
Canvas
Coordinate system of a
Canvas