Programming Course for Beginners - ZedLX

The Easiest Online Computer Programming Course, for Free

Iteration [5/10]

In this example, the loop control variable is named k.
[Run the program]

The variable k is also a part of the compound expression k*3.

Name of a variable is a primary expression. Primary expressions can be combined to form more complex expressions.

Numbers are also primary expressions. In this example, the number 3 is a primary expression, which is a part of the compound expression k*3.

Exercises:

1. Insert a statement println "Program ends"; at the end of the source code (below the body of the loop).
[Run the program]

2. Insert a new line inside the body of the for loop. In the new line, write a statement sleepMs(200); [Run the program]

Loading...