What is the order of execution in a for loop?

Suppose you have three blocks positioned side by side. Will this code:

var once = false

for (var block : GameObject in blocks){
    if (!once){
        turn45degrees(block)
    }
    once = true;
}

A) Turn all the blocks (turn45degrees() on each block, then set once to true three times)

B) Turn one block (turn45degrees() on the first block, then set once to true, so the other blocks can’t turn)

1 Like

B.
For loops just repeat the same segment of code multiple times. The order of execution doesn’t change.
(In other words, think of the loop as a mini function that is called until a condition is met.)