Skip to content
Sign in
Computer

Which loop is suitable to use in situations where the programmer does not know the number of time the body of the loop will be executed?

Tap an option to check the answer. You can also press A–D.

Explanation
The do-while loop is useful when the loop must run at least once, even if the condition is false initially. It's suitable when the number of iterations is not known in advance and depends on runtime conditions.