是否有退出嵌套过程及其所有者过程的 Exit 方法?
Is there an Exit method to exit a nested procedure and its owner procedure?
是否有一种方法可以从嵌套过程中调用 Exit 也将退出 owner/parent 过程?
procedure OwnerProc;
procedure NestedProc;
begin
// Do some code here
EXIT_ALL; {Call a method which will exit NestedProc and OwnerProc}
end;
begin
NestedProc;
end;
Is there a method one could call to Exit from inside a nested procedure which will also exit the owner/parent procedure?
没有。
您可以引发异常,并在外部函数中捕获它。但就我个人而言,我认为那是相当丑陋的。也许更清洁的是 return 来自内部函数的布尔值,然后 exit
如果内部函数 returns False
.
是否有一种方法可以从嵌套过程中调用 Exit 也将退出 owner/parent 过程?
procedure OwnerProc;
procedure NestedProc;
begin
// Do some code here
EXIT_ALL; {Call a method which will exit NestedProc and OwnerProc}
end;
begin
NestedProc;
end;
Is there a method one could call to Exit from inside a nested procedure which will also exit the owner/parent procedure?
没有。
您可以引发异常,并在外部函数中捕获它。但就我个人而言,我认为那是相当丑陋的。也许更清洁的是 return 来自内部函数的布尔值,然后 exit
如果内部函数 returns False
.