Looping is a fundamental component of program logic. There have been looping algorithms since the advent of computers, and more so, since the advance of mathematics and calculus.

Yes, in Maths…

*image found in Google search*

That is the language of looping in math, in particular the summation of a series of repeated operations where `k`

changes in each one, and `k`

makes a sequence that starts with `0`

and progresses thru to `199`

.

How do we replicate that with a `for`

loop?

We will need an *accumulator* so define a variable and give it an initial value of `0`

.

```
let s = 0
```

The `k`

variable will be defined in the loop’s parameters.

```
for (let k = 0; ;) {}
```

Above we initialize it to zero, as the illustration shows.

We know from above that the upper limit of `k`

is `199`

, so our *continuation condition* will control that…

```
for (let k = 0; k < 200; ) {}
```

Finally we need to increment `k`

on each iteration so, like the above, it is always different and follows a sequence.

```
for (let k = 0; k < 200; k++) {
}
```

We’ve set the stage for our loop; all it needs now is a code body, the steps that will be carried out with each iteration. In this case the step is simple… Add `7 + 2 * k`

to `s`

.

```
for (let k = 0; k < 200; k++) {
s += 7 + 2 * k;
}
```

The final summation will be referenced by `s`

.

`console.log(s) // 41200`