3 Formatting blockquote

0 Let V be undefined.
1 Perform ? CreatePerIterationEnvironment(perIterationBindings).
2 Repeat
3 If If is not [empty], then
4 Let  Let testRef be the result of evaluating <test>.
5 Let  Let testValue be ? GetValue(testRef).
6 If  If ToBoolean(testValue) is false, return NormalCompletion(V).
7 Let Let result be the result of evaluating <statement>.
8 If If LoopContinues(result, labelSet) is false, return Completion(UpdateEmpty(result, V)).
9 If If result.[[Value]] is not empty, let V be result.[[Value]].
10 Perform Perform ? CreatePerIterationEnvironment(perIterationBindings).
11 If If is not [empty], then
12 Let  Let incRef be the result of evaluating <increment>.
13 Perform  Perform ? GetValue(incRef).

0 Let V be undefined.
1 Perform ? CreatePerIterationEnvironment(perIterationBindings).
2 Repeat
3 If is not [empty], then
4 Let testRef be the result of evaluating <test>.
5 Let testValue be ? GetValue(testRef).
6 If ToBoolean(testValue) is false, return NormalCompletion(V).
7 Let result be the result of evaluating <statement>.
8 If LoopContinues(result, labelSet) is false, return Completion(UpdateEmpty(result, V)).
9 If result.[[Value]] is not empty, let V be result.[[Value]].
10 Perform ? CreatePerIterationEnvironment(perIterationBindings).
11 If is not [empty], then
12 Let incRef be the result of evaluating <increment>.
13 Perform ? GetValue(incRef).

0 Let V be undefined.
1 Perform ? CreatePerIterationEnvironment(perIterationBindings).
2 Repeat
3  If is not [empty], then
4   Let testRef be the result of evaluating <test>.
5   Let testValue be ? GetValue(testRef).
6   If ToBoolean(testValue) is false, return NormalCompletion(V).
7  Let result be the result of evaluating <statement>.
8  If LoopContinues(result, labelSet) is false, return Completion(UpdateEmpty(result, V)).
9  If result.[[Value]] is not empty, let V be result.[[Value]].
10  Perform ? CreatePerIterationEnvironment(perIterationBindings).
11  If is not [empty], then
12   Let incRef be the result of evaluating <increment>.
13   Perform ? GetValue(incRef).

2 Explanations on how could be define a full cycle

Taking the following as an example, is the <increment> the end of the first cycle or the beginning of the second cycle ?

0:for(<init>;<test>;<increment>)
1:{
2:  <statement>;
3:}


### 1/ I see it

After going from lines 0 to line 3 then going back to line 0, it feels like a full cycle has been completed.
That would make the <increment> the beginning of the second cycle.
- First cycle : <init> -> <test> -> <statement>
- Second cycle : <increment> -> <test> -> <statement>

### 2/ While equivalent

0:<init>;
1:while(<test>)
2:{
3:  <statement>;
4:  <increment>;
5:}


In this equivalent while the <increment> is the end of the first cycle and it feels like it's the same with the for.
That would make the <increment> the end of the first cycle.
- First cycle : <test> -> <statement> -> <increment>
- Second cycle : <test> -> <statement> -> <increment>

### 3/ A statement is encountered twice

A full cycle is completed when a statement is encountered twice.
The first statement encountered twice is <test>.
That would make the <increment> the end of the first cycle.
- First cycle : <test> -> <statement> -> <increment>
- Second cycle : <test> -> <statement> -> <increment>

### 4/ It's a setup

The <init> is just setting up whatever is needed for the first cycle.
The <increment> is just setting up whatever is needed for the second cycle.
That would make the <increment> the beginning of the second cycle.
- First cycle : <init as a setup> -> <test> -> <statement>
- Second cycle : <increment as a setup> -> <test> -> <statement>

The ECMAScript® 2016 Language Specification

Runtime of for(<init>;<test>;<increment>)<statement>;

Let varDcl be the result of evaluating <init>.
ReturnIfAbrupt(varDcl).
Return ? ForBodyEvaluation(<test>, <increment>, <statement>, « », labelSet).

There are three forms, so I took the shortest one here, there's no difference:
- Whatever the <init> it isn't part of the first iteration.
- What's relevant is in ForBodyEvaluation.

Details of ForBodyEvaluation(<test>, <increment>, <statement>, « », labelSet)

0 Let V be undefined.
1 Perform ? CreatePerIterationEnvironment(perIterationBindings).
2 Repeat
3 If is not [empty], then
4 Let testRef be the result of evaluating <test>.
5 Let testValue be ? GetValue(testRef).
6 If ToBoolean(testValue) is false, return NormalCompletion(V).
7 Let result be the result of evaluating <statement>.
8 If LoopContinues(result, labelSet) is false, return Completion(UpdateEmpty(result, V)).
9 If result.[[Value]] is not empty, let V be result.[[Value]].
10 Perform ? CreatePerIterationEnvironment(perIterationBindings).
11 If is not [empty], then
12 Let incRef be the result of evaluating <increment>.
13 Perform ? GetValue(incRef).

### 6/ I see it

A full cycle a full run of the repeat part.
That would make the <increment> the end of the first cycle.
- First cycle : <test> -> <statement> -> <increment> / In other words from line 3 to line 13
- Second cycle : <test> -> <statement> -> <increment> / In other words from line 3 to line 13

### 7/ A cycle is an iteration

A cycle begin with CreatePerIterationEnvironment.
So when CreatePerIterationEnvironment is encountered a new cycle begins, thus ending the previous one.
That would make the <increment> the beginning of the second cycle.
- First cycle : <test> -> <statement> / In other words from line 1 to line 9
- Second cycle : <increment> -> <test> -> <statement> / In other words from line 10 looping until line 9

Is the <increment> the end of the first cycle or the beginning of the second cycle?

The right explanation is either 6 or 7.

Taking the following as an example, is the <increment> the end of the first cycle or the beginning of the second cycle ?

0:for(<init>;<test>;<increment>)
1:{
2:  <statement>;
3:}


### 1/ I see it

After going from lines 0 to line 3 then going back to line 0, it feels like a full cycle has been completed.
That would make the <increment> the beginning of the second cycle.
- First cycle : <init> -> <test> -> <statement>
- Second cycle : <increment> -> <test> -> <statement>

### 2/ While equivalent

0:<init>;
1:while(<test>)
2:{
3:  <statement>;
4:  <increment>;
5:}


In this equivalent while the <increment> is the end of the first cycle and it feels like it's the same with the for.
That would make the <increment> the end of the first cycle.
- First cycle : <test> -> <statement> -> <increment>
- Second cycle : <test> -> <statement> -> <increment>

### 3/ A statement is encountered twice

A full cycle is completed when a statement is encountered twice.
The first statement encountered twice is <test>.
That would make the <increment> the end of the first cycle.
- First cycle : <test> -> <statement> -> <increment>
- Second cycle : <test> -> <statement> -> <increment>

### 4/ It's a setup

The <init> is just setting up whatever is needed for the first cycle.
The <increment> is just setting up whatever is needed for the second cycle.
That would make the <increment> the beginning of the second cycle.
- First cycle : <init as a setup> -> <test> -> <statement>
- Second cycle : <increment as a setup> -> <test> -> <statement>

The ECMAScript® 2016 Language Specification

Runtime of for(<init>;<test>;<increment>)<statement>;

Let varDcl be the result of evaluating <init>.
ReturnIfAbrupt(varDcl).
Return ? ForBodyEvaluation(<test>, <increment>, <statement>, « », labelSet).

There are three forms, so I took the shortest one here, there's no difference:
- Whatever the <init> it isn't part of the first iteration.
- What's relevant is in ForBodyEvaluation.

Details of ForBodyEvaluation(<test>, <increment>, <statement>, « », labelSet)

0 Let V be undefined.
1 Perform ? CreatePerIterationEnvironment(perIterationBindings).
2 Repeat
3 If is not [empty], then
4 Let testRef be the result of evaluating <test>.
5 Let testValue be ? GetValue(testRef).
6 If ToBoolean(testValue) is false, return NormalCompletion(V).
7 Let result be the result of evaluating <statement>.
8 If LoopContinues(result, labelSet) is false, return Completion(UpdateEmpty(result, V)).
9 If result.[[Value]] is not empty, let V be result.[[Value]].
10 Perform ? CreatePerIterationEnvironment(perIterationBindings).
11 If is not [empty], then
12 Let incRef be the result of evaluating <increment>.
13 Perform ? GetValue(incRef).

### 6/ I see it

A full cycle a full run of the repeat part.
That would make the <increment> the end of the first cycle.
- First cycle : <test> -> <statement> -> <increment> / In other words from line 3 to line 13
- Second cycle : <test> -> <statement> -> <increment> / In other words from line 3 to line 13

### 7/ A cycle is an iteration

A cycle begin with CreatePerIterationEnvironment.
So when CreatePerIterationEnvironment is encountered a new cycle begins, thus ending the previous one.
That would make the <increment> the beginning of the second cycle.
- First cycle : <test> -> <statement> / In other words from line 1 to line 9
- Second cycle : <increment> -> <test> -> <statement> / In other words from line 10 looping until line 9

Is the <increment> the end of the first cycle or the beginning of the second cycle?

The right explanation is either 6 or 7.

1

# JavaScript, 9 bytes

for(;;i);


This runs once, then throws ReferenceError: i is not defined which stops the loop.

// With a console.log(1) to see that it runs once.
for(;;i)console.log(1);