有没有一种方法可以从嵌套的过程中调用以退出同时也退出所有者/父过程?
procedure OwnerProc;
procedure NestedProc;
begin
// Do some code here
EXIT_ALL; {Call a method which will exit NestedProc and OwnerProc}
end;
begin
NestedProc;
end;
有没有一种方法可以从嵌套的过程中调用以退出同时也退出所有者/父过程?
procedure OwnerProc;
procedure NestedProc;
begin
// Do some code here
EXIT_ALL; {Call a method which will exit NestedProc and OwnerProc}
end;
begin
NestedProc;
end;
是否有一种可以从嵌套过程中调用以退出并且也会退出所有者/父过程的方法?
没有这种方法。
你可以引发一个异常,并在外部函数中捕获它。但个人认为这样做比较丑陋。也许更好的方法是从内部函数返回一个布尔值,然后如果内部函数返回False,则使用exit
退出。
Halt;
就能够完成工作 ;) - 警告:只在特殊情况下使用。 - mjn