The COBOL perform loop is the equivalent of which of the following structures found in other languages, such as Java or C++
-
For loop
-
Do-While loop
-
Method
-
None of the above
B
Correct answer
Explanation
The COBOL PERFORM loop is equivalent to a Do-While loop found in other procedural languages. Like a Do-While loop, the PERFORM...UNTIL structure executes the loop body at least once before checking the termination condition. The 'UNTIL' clause specifies the condition that, when true, causes the loop to exit. This behavior differs from a While loop (which checks the condition before execution) but matches the Do-While pattern of execute-then-check.