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

IF .. ENDIF

Former Member
0 Likes
945

Hi,

I m having a loop in tht i m checking one condition if its satisfied i will continue else my control have to go to next statement.. how to do this..

I tried to use continue but its going to loop statement not to the next statement below if condition ...

Eg.

loop at it.

if a < 50.

b = a + b.

else.

continue.

endif.

a = a / 10.

move a to c.

write c.

endloop.

here if a > 50 means my control has to go to a = a / 10 statement.

when i used continue the control goes to loop at it.

what is the exact keyword to be used.

the requirement is i should not place

<b>a = a / 10.

move a to c.

write c.</b>

in elseif part.

Can anyone guide me..

Thanks in advance.

Maya.

6 REPLIES 6
Read only

rainer_hbenthal
Active Contributor
0 Likes
854

just delete else and continue.

Read only

Former Member
0 Likes
854

Hi,

try this.

loop at it.

if a < 50.

b = a + b.

else.

a = a / 10.

move a to c.

write c.

endif.

endloop.

Reward if solves your problem.

Read only

Former Member
0 Likes
854

Hi,

Try this Code

loop at it.

if a < 50.

b = a + b.

else.

a = a / 10.

move a to c.

write c.

endif.

endloop.

Thanks

Yogesh

Read only

Former Member
0 Likes
854

Hi.

This is the correct code.

loop at it.

if a < 50.

b = a + b.

else.

a = a / 10.

move a to c.

write c.

endif.

endloop.

U have not used ELSE and CONTINUE correctly.

Once the control reaches the <b>Continue</b> keyword will go back to the loop only, it will neglect the remaining statement under the CONTINUE ..

Hope it wll helps

Regards

Bala..

Read only

Former Member
0 Likes
854

Hi,

why

"the requirement is i should not place

a = a / 10.

move a to c.

write c.

in elseif part"?

Do you need to execute this code ever?

Regards,

Gianpietro Dal Zio

Read only

Clemenss
Active Contributor
0 Likes
854

Hi Maya,

if you want to leave the loop then EXIT is the statement to be used.

Regards,

Clemens