Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Cobol

Idiom #78 "do while" loop

Execute a block once, then execute it again as long as boolean condition c is true.

IDENTIFICATION DIVISION.
PROGRAM-ID. "do while" loop.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 boolean-c    PIC x.
   88 c-true    PIC x VALUE 't'.
   88 c-false   PIC x VALUE 'f'.
PROCEDURE DIVISION.
    PERFORM WITH TEST AFTER UNTIL c-false
       PERFORM somthing
    END-PERFORM   
STOP RUN.
loop
   stuff();
   if not c then
      exit;
   end if;
end loop;

New implementation...
< >
deleplace