Results 1 to 3 of 3

Thread: Exit;

  1. #1
    Join Date
    Feb 2012
    Posts
    170
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default Exit;

    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?

  2. #2
    Join Date
    Feb 2012
    Location
    Somewhere, over the rainbow...
    Posts
    2,272
    Mentioned
    3 Post(s)
    Quoted
    45 Post(s)

    Default

    It should, no reason it shouldn't.

    If you are in a loop, then use Break;

  3. #3
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •