Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an Exit method to exit a nested procedure and its owner procedure?

Is there a method one could call to Exit from inside a nested procedure which will also exit the owner/parent procedure?

procedure OwnerProc;

    procedure NestedProc;
    begin
      // Do some code here

      EXIT_ALL; {Call a method which will exit NestedProc and OwnerProc}
    end;

begin
  NestedProc;
end;
like image 681
Blurry Sterk Avatar asked Jan 13 '16 10:01

Blurry Sterk


1 Answers

Is there a method one could call to Exit from inside a nested procedure which will also exit the owner/parent procedure?

No there is not.

You could raise an exception, and catch it in the outer function. But personally I would regard that as rather ugly. Perhaps cleaner is to return a boolean from the inner function and then exit if the inner function returns False.

like image 54
David Heffernan Avatar answered Nov 03 '22 19:11

David Heffernan