0

Aren't Repeat-While loops just unnecessary since they can be easily replaced by While loops?

26th May 2016, 10:05 AM
Nicole
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.
28th May 2016, 3:20 PM
ic01010101 ◌LM
ic01010101 ◌LM - avatar