Part 1
-
We can use the while statement to loop.
-
The while statement is repeated if the value or expression is true.
-
A loop that never stops running because the value or expression is always true.
-
A loop basically.
Part 2
-
A loop is used when it is known how many times its needed ro iterate. A while function is used when we have to loop during a undefined period.
-
for(int x=0; x < length; x++) {/code block/}
-
The error occurs when the loop iterates one too many or one to few times.