IF Statement exit

infonoteinfonote Member Posts: 233
Hi,

I have created a function in a codeunit. I do not want some lines to be posted. I am using an IF statement.

The question is as follows:
If a certain condition is met, is there a command to skip the rest of the code, but continue the loop?

IF I use ERROR() the whole statement will stop.

Repeat
If condition then begin

If X =1 then
Exit (process next line).

end;
UNTIL i := 0;


I am using a large codeunit so it is a bit difficult to make an IF THEN ELSE statement for all the code.

Thanks

Comments

  • bbrownbbrown Member Posts: 3,268
    Put the loop code in a another function or second codeunit. Test for the condition there and exit if needed.
    There are no bugs - only undocumented features.
  • infonoteinfonote Member Posts: 233
    Thanks,

    I solved the problem by using filtering. In this way I avoid checking the data during the loop.
Sign In or Register to comment.