A loop is a control statement that allows us to repeat a code block. Loops contain a conditional which determines how many times the code block is repeated.
...
This is the same as the while loop, but we check the condition at the end of the code block. The do-while-loop will always execute at least once, no matter the condition.
Code Block |
---|
int x=0; do { println(x); x++; }while(x <= 100); |
Aufgabe
...
Exercise 6
Write a program that creates a line of animated icons on the screen using a loop. Make use of the sin() function to create a simple oscillation.