This form of syntax should only be used when you want the body of the loop to execute at least once regardless of the condition being truthy. Usually, the other form is preferred: while(…) {…}.
Any part of for can be skipped
A break directive must be inside a code block. Technically, any labelled code block will do
The combination “infinite loop + break as needed” is great for situations when a loop’s condition must be checked not in the beginning or end of the loop, but in the middle or even in several places of its body.
Summary We covered 3 types of loops: while – The condition is checked before each iteration. do..while – The condition is checked after each iteration. for (;;) – The condition is checked before each iteration, additional settings available. To make an “infinite” loop, usually the while(true) construct is used. Such a loop, just like any other, ca...
Glasp is a social web highlighter that people can highlight and organize quotes and thoughts from the web, and access other like-minded people’s learning.