▶ LOOPING BY INDEX

Looping by index is the repeating of code execution for a set number of times.

Looping by index format:

Looping by index format:

[INDEX] [RANGE] ~

Consider this code:
```
sum 0
```

index 4 ~

num index + 1

sum ++ num

print sum

ᐤ

1

3

6

10

3

6

10

In line: '

In the repeat block,

The code in the repeat block is summing the numbers: 1, 2, 3, 4. Each time the sum is printed.

The above looping statement can be written in one line:

`index 4 ~`

', `index`

will be a local numeric variable of
the looping statement, and the value: 4, is the range. The index will get the numbers
from zero until 4 (not including 4): 0, 1, 2, 3.In the repeat block,

`index`

variable will be used, and each time it will have
a different value.The code in the repeat block is summing the numbers: 1, 2, 3, 4. Each time the sum is printed.

The above looping statement can be written in one line:

```
sum 0
```

index 4 ~ print
sum ++ index + 1

Average Calculator:

```
sum 0
```

numbers_len 4

index numbers_len ~
sum ++ index + 1

print sum / numbers_len

2.5