Programming for Beginners and Kids - ZedLX

The Easiest Online Computer Programming Course, for Free

Iteration [1/8]

Iteration

Run the given program by clicking on the Run button, or by pressing the F8 key. [F8:Run]

A for loop executes statements of a statement block multiple times.

A statement block consists of statements enclosed inside braces {} (i.e. curly brackets).

It can be said that a for loop repeats, or iterates, the execution of the following statement block.

In this example, the number of iterations is 7.

The statement sleepMs(600) slows down execution of the program.

After running the program, try changing the number 600 (called: the argument of the sleepMs function) to values 200 and 1800 to see how it affects the program execution.

Loading...