Programming Course for Beginners - ZedLX

The Easiest Online Computer Programming Course, for Free

Iteration [8/8]

In this example, the value of the loop control variable n is increased by 3 in each iteration. In other words, the step of this for loop equals 3. [F8:Run]

The step of the for loop is specified after the symbols +=.

Exercise:

Change the loop so that the variable n starts from value 50 and then decreases by 3 in each iteration.

Solution

for #n= 50 .. 1  -=3

Loading...