gpt4 book ai didi

delphi - 你能检查是否调用了 Exit()

转载 作者:行者123 更新时间:2023-12-01 23:47:54 25 4
gpt4 key购买 nike

开发人员可以检查是否调用了 Exit 吗?

try
{do some stuff}
If Condition then
Exit;
finally
{Can I check here if Exit was called without checking Condition again?}
end;

最佳答案

Can I check here if Exit was called without checking Condition again?

没有。如果检查 Condition again 很昂贵,或者有副作用,那么你可以使用局部变量来指示 ConditionTrue .

var
LCondition: Boolean;
...
LCondition := False;
try
// do stuff
LCondition := Condition;
if LCondition then
Exit;
finally
// now check LCondition
end;

关于delphi - 你能检查是否调用了 Exit(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63917558/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com