View previous topic :: View next topic
|
Author |
Message |
hsbawari Currently Banned New User
Joined: 16 Sep 2008 Posts: 9 Location: chennai
|
|
|
|
I am using a DO loop in a program,
No I ahve also used a n If condition inside it so I wnat to get exit when a particular if condition is true so how do I do that.
Can a break statement be used to come out of the Do loop??? |
|
Back to top |
|
|
hsbawari Currently Banned New User
Joined: 16 Sep 2008 Posts: 9 Location: chennai
|
|
|
|
Its a PL/I program |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Try a LEAVE statement. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Have you tried it before posting ? |
|
Back to top |
|
|
hsbawari Currently Banned New User
Joined: 16 Sep 2008 Posts: 9 Location: chennai
|
|
|
|
Cant really get wht u tryn to say..
I am new to PL/I
I just have this problem that I am stuck in a DO loop. I want to get out of it. In C and object oriented languages we have Break statement..
Do we have anything like this in Pl/I |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Did you try LEAVE as Robert suggested?
What happened? |
|
Back to top |
|
|
murugan_mf
Active User
Joined: 31 Jan 2008 Posts: 148 Location: Chennai, India
|
|
|
|
Quote: |
DO ;
statement1 ;
statement2 ;
IF ITEM_1 = 5
THEN
LEAVE ;
statement3 ;
statement4 ;
END ;
statement5 ; |
the LEAVE statement, if executed, transfers control to statement5. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
This is the desired result, right? |
|
Back to top |
|
|
|