RPG Branching Operations - LEAVE (Leave a Do/For Group)

Description: Exits the current loop.

Legacy RPG400 Example:

C            LEAVE

Modern RPGLE Example:

leave;

Example of Usage:
Here a condition is compared at the LEAVE opcode will leave the bottom of the loop:

Dow Fielda < Fieldb;

 // some silly maths logic for this code sample
 Fielda = x * n / y;
 Fieldb = 14 + Fieldz;
 FieldC += (Fielda/Fieldc)

 // if FieldC is zero then loop to top of the DOW loop and continue
 if FieldC = 0;
   iter;
 endif;
 // if FieldC is 99 then loop out of bottom DOW loop and continue
 if FieldC = 99;
   leave;
 endif;
 
// do some other logic here
enddo;
{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}
>