Professional Documents
Culture Documents
Loops: DO - ENDDO - Unconditional Loop
Loops: DO - ENDDO - Unconditional Loop
WHILE ENDWHILE Conditional Loop WHILE can be used to execute a certain lines of codes as long as the condition is true. WHILE sy-index < 3. WRITE sy-index. ENDWHILE. Output
CONTINUE
Terminate a loop pass unconditionally. After continue the control directly goes to the end statement of the current loop pass ignoring the remaining statements in the current loop pass, starts the next loop pass. DO 5 TIMES. IF sy-index = 2. CONTINUE. ENDIF. WRITE sy-index. ENDDO. Output
CHECK
Terminate a loop pass conditionally. If the condition is false, the control directly goes to the end statement of the current loop pass ignoring the remaining statements in the current loop pass, starts the next loop pass. DO 5 TIMES.
EXIT
Terminate an entire loop pass unconditionally. After EXIT statement the control goes to the next statement after the end of loop statement. DO 10 TIMES. IF sy-index = 2. EXIT. ENDIF. WRITE sy-index. ENDDO. Output