Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

deutsche Version

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.

...

Code Block
int x=0;
do
{
   println(x);
   x++;
}while(x <= 100);

Exercise 6

Write a program that creates a forrest line of animated icons on the screen using a loop. (hint, you will need to put a loop inside another loop) Make use of the sin() function to create a simple oscillation.