0
Aren't Repeat-While loops just unnecessary since they can be easily replaced by While loops?
1 Answer
0
Repeat...while and while serve different purposes. The while loop checks the condition before execution the code within the while block.
However, the Repeat....while executes the code first, then checks the condition afterwards. If the conditional is true, the code is executed again. This repeat....while structure guarantees that the code will execute at least once. It might execute only once, but we know the code executes that one time regardless of the conditional it true or false.