In the section "Using a for loop instead of while loop", the text implies that the two code snippets are identical.
However, they only behave identically if cell.x is initialized to 0 before the loop runs. If cell.x starts at any other value, the for loop will overshoot the board_size.x - 1 limit because it executes a fixed number of times, whereas the while loop evaluates the condition dynamically on every iteration.
Suggested fix:
Add a brief note mentioning that this simplification assumes cell.x starts at 0.
In the section "Using a for loop instead of while loop", the text implies that the two code snippets are identical.
However, they only behave identically if cell.x is initialized to 0 before the loop runs. If cell.x starts at any other value, the for loop will overshoot the board_size.x - 1 limit because it executes a fixed number of times, whereas the while loop evaluates the condition dynamically on every iteration.
Suggested fix:
Add a brief note mentioning that this simplification assumes cell.x starts at 0.