View previous topic :: View next topic
|
Author |
Message |
GAFUR
New User
Joined: 19 May 2005 Posts: 31
|
|
|
|
Hi ,
Can i use a CONTINUE statement in if-loop with out scope terminator END-IF. Will it show any compilation error? If Not ,What happen to that if-loop while executing the program?
Shall any body explain.
Regards
Gafur. |
|
Back to top |
|
|
subhasis_50
Moderator
Joined: 09 Mar 2005 Posts: 363 Location: Earth
|
|
|
|
Hi,
If you use continue without END-IF you will not get any compile error. The control passes during the time of execution until it finds any terminator. So continue will start after that statement.
For example:
IF VAR1 = 0
CONTINUE
ELSE
PERFORM 111-PARA
END-IF.
DISPLAY 'HELLO'
PERFORM 222-PARA.
DISPLAY 'WORLD'
In normal condition if condition is satisfied the control passed to first display statement and continue execution. If you will not code END-IF, control comes in the 2nd display directly if the condition matches in the IF statement.
Please let me know if you have any doubt |
|
Back to top |
|
|
GAFUR
New User
Joined: 19 May 2005 Posts: 31
|
|
|
|
Hi Subhasis,
That means if you code period instead of END-IF, Control will goes to the statement following this period.Am i right?
Then for following the result is 'HELLO' if the IF condition pass.
IF VAR1 = 0
CONTINUE
ELSE
PERFORM 111-PARA.
DISPLAY 'HELLO' .
Regards
Gafur. |
|
Back to top |
|
|
subhasis_50
Moderator
Joined: 09 Mar 2005 Posts: 363 Location: Earth
|
|
|
|
Hi,
Yes u r right. It is better that u should write the code and test it. |
|
Back to top |
|
|
|