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?
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?
It should, no reason it shouldn't.
If you are in a loop, then use Break;
Simply a GOD beast...
My Tutorials
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:
Simba Code: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:
Simba Code: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.
I am Ggzz..
Hackintosher
There are currently 1 users browsing this thread. (0 members and 1 guests)