Turtle Graphics with Java
|Bern University of Teacher Education|
|To draw a square with the Turtle in the first example Tu1, the programer had to repeat the two lines
A more elegant solution is the Java program structure of the Iteration (Repetition). One or more condotions are set and the following actions are executed as long as the conditions are meet.
Run this example (Tu2.java)
Explaining the program code:
||is equal to i = i + 1. The value of i is increased by 1 after each repetition.|