SRL Archive - OSR Help

Exit;


xdarkshadowx

2012-05-08 17:48:44

Exit and Exit(procedure name); aren't working for me. I want to quit a procedure if a certain condition exists and I'm checking it with an If statment. Any reasons why Exit wouldn't kill the current procedure and continue in the main?

Abu

2012-05-08 17:50:20

It should, no reason it shouldn't.

If you are in a loop, then use Break;

Brandon

2012-05-08 18:00:24

Can't do that.. Exit is called before the procedure then it will exit the previous/running function which just happens to be main.

Example:

Procedure Meh;
begin
writeln('This won''t run');
end;

begin
repeat
Exit(Meh);
until(False);
end.

This is because Simba runs Top to bottom and left to right. It's how most languages work.

You have to do:

var
Bool: Boolean;

Procedure Meh;
begin
if (Not Bool) then
Exit;

writeln('This will run if Bool = True')
end;

begin
Bool:= True;
repeat
Meh;
//Some other stuff that will run even if Meh = false;
until(False);
end.