Learn to Program with ZedLX

Free Online Programming Course for Beginners

Basics of for Loops [4/10]

In this example, the body of the for loop contains three statements inside a statement block.
[Run the program]

This program uses two keywords: for and println. Keywords are colored in blue.

In contrast, procedure names are not colored. Procedures use arguments inside parentheses.

The argument of the sleepMs procedure is 500 milliseconds, which is half a second.

Exercise:

1. Inside the for loop body, add the statement: println i;

Loading...