While Loops
The while loop repeatedly executes a code block as long as the condition is true. It checks the condition first before deciding whether to execute the loop body. If the condition is false from the beginning, the loop body will never execute.
The do-while loop executes the loop body first, then checks the condition. This means the loop body will execute at least once, even if the condition is false from the beginning.
Similar to many languages, the conditions for while and do-while must be Boolean expressions. In the loop body, you typically need to modify variables related to the condition, otherwise it may result in an infinite loop.
Try modifying the conditional expression and observe how the number of iterations changes.