Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1
It's just how they are formed syntactically. The `while` loop evaluates the loop condition before processing the statement(s) in the loop body. For this reason the loop condition is placed above, near the `while` statement. The `do-while` loop processes the statement(s) in the loop body once before the loop condition is evaluated. This is why the loop condition is placed at the bottom, after the loop body block.
18th Jan 2020, 7:35 AM
Ipang