Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to exit the outer loop?

Former Member
0 Likes
3,137

Hello,

Could anyone help on how to exit all the loops? I have nested loops like below:

-


LOOP1

LOOP2

LOOP3

Condition.

ENDLOOP3

ENDLOOP2

ENDLOOP1

Other Statements.

-


If the condition is met, how to jump out of all the loops and then the program continues with Other Statements. Is there any direct keyword for this? (like EXIT, CONTINUE)

Thank you,

Yang

1 ACCEPTED SOLUTION
Read only

vinod_vemuru2
Active Contributor
0 Likes
1,491

Hi,

I don't think we have such fecility. You need to place the checks and exit from the loop.


LOOP1 
CLEAR l_flag.
LOOP2
LOOP3

If Condition.satisfied.
l_flag = 1.
EXIT.
endif.

ENDLOOP3

If l_flag = 1.
EXIT.
ENDIF.

ENDLOOP2

If l_flag = 1.
EXIT.
ENDIF.

ENDLOOP1

Thanks,

Vinod.

4 REPLIES 4
Read only

vinod_vemuru2
Active Contributor
0 Likes
1,492

Hi,

I don't think we have such fecility. You need to place the checks and exit from the loop.


LOOP1 
CLEAR l_flag.
LOOP2
LOOP3

If Condition.satisfied.
l_flag = 1.
EXIT.
endif.

ENDLOOP3

If l_flag = 1.
EXIT.
ENDIF.

ENDLOOP2

If l_flag = 1.
EXIT.
ENDIF.

ENDLOOP1

Thanks,

Vinod.

Read only

0 Likes
1,491

Vinod, thanks for the solution.

Read only

Former Member
0 Likes
1,491

the short answer is YES; we have exit and we have continue.

insert the keyword, put your cursor on the word, press F1 and read...

Read only

0 Likes
1,491

David, do you mean there is other possible keyword that can help to exit more than one loop at a time?