
6.6 Constructing Loop Conditions 319
while loop body. Thus, within the while loop, we increment both x and y. We
continue as long as the ball has not rolled beyond the right edge of the win-
dow and the ball has also not rolled beyond the bottom of the window.
Let’s develop the condition by applying our three steps:
1. The loop termination condition is that the ball has rolled beyond either
the right edge of the window or the bottom edge of the window.
// the ball is out of bounds
( ball.getX( ) + ballDiameter > windowWidth
|| ball.getY( ) + ballDiameter > windowHeight )
2. The loop continuation condition is created by applying the logical
NOT operator ...