Write counting loops with for.
In this video:
for (start; condition; step) { ... }keeps everything that controls the loop in one linestartruns once, before the loopconditionis checked before every round, as inwhilestepruns at the end of every round, such as++ii++gives the old value and then adds one;++iadds one and gives the new value- In a
forloop,continuestill runs the step, unlike the counter at the end of awhileloop