Pay attention to the structure of the for statement:
for (initializer; condition; iterator) { body }
The break statement immediately completes the nearest outer loop or switch statement in which it appears. Control is transferred to the operator following the completed operator (if one exists). In this example, it goes beyond the cycle, i.e. variable increment does not occur.
In the second case, there is no break statement, i.e. the body of the loop is executed while the condition expression is true.
In order to interrupt the execution of the current iteration of the loop and move on to the next, the operator continue is used
Important! First, an iterator is executed, and after it the condition is calculated. Iterator is executed only once - at the very beginning of the cycle, in front of all parts of the cycle. In this case, the iterator is skipped and the condition condition is checked.