View previous topic :: View next topic
|
Author |
Message |
hsiva2003
New User
Joined: 22 Feb 2005 Posts: 10 Location: Chennai
|
|
|
|
Can we have statements above / after continue ... |
|
Back to top |
|
|
shreevamsi
Active User
Joined: 23 Feb 2006 Posts: 305 Location: Hyderabad,India
|
|
|
|
Logically have an statement above/after a CONTINUE
sounds Odd |
|
Back to top |
|
|
cj10
New User
Joined: 18 Sep 2006 Posts: 9
|
|
|
|
Hi,
By statements above & below CONTINUE, do you mean the following ?
Code: |
IF DEPT = "X"
Compute Bonus = Sal * 0.2 ===> Above
Continue
ADD 1 To X-DEPT-CNT ===> Below
ELSE
Compute Bonus = Sal * 0.5
END-IF |
You will not have any compilation errors. However, logically this is not correct. Even without CONTINUE, the prg will execute the statements before & after the CONTINUE statement. |
|
Back to top |
|
|
hsiva2003
New User
Joined: 22 Feb 2005 Posts: 10 Location: Chennai
|
|
|
|
Can U plzz tell me How statements after continue will get displayed.... |
|
Back to top |
|
|
cj10
New User
Joined: 18 Sep 2006 Posts: 9
|
|
|
|
In the above example, if DEPT = "X", X-DEPT-CNT will have 1 & control comes out of the IF-ENDIF loop. |
|
Back to top |
|
|
b4uthammi Warnings : 2 New User
Joined: 21 Feb 2005 Posts: 14 Location: hyderabad
|
|
|
|
hai,
Code: |
IF A=B
CONTINUE
ELSE
MOVE 5 T0 A
END-IF
IF C=D
DISPLAY "HAI"
ELSE
DISPLAY "HELLO"
END-IF. |
If A=B is true,then control will transfer to IF c=d condition i.e next statement after IF---END-IF block .
having statement after or above CONTINUE does't make sense to the program.
regards
Tr |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Yes Tr is right .
Code: |
IF A=B
CONTINUE
ELSE
MOVE 5 T0 A
END-IF |
if we put some stmt like display 'hi' just befor CONTINUE
Code: |
IF A=B
DISPLAY 'HI'
CONTINUE
ELSE
MOVE 5 T0 A
END-IF |
THEN THERE IS NO NEED TO PUT CONTINUE STATEMENT.
So hope it is clear now that having statement after or above CONTINUE does't make sense to the program. |
|
Back to top |
|
|
|