前端之家收集整理的这篇文章主要介绍了
退出Delphi中的“if”,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
你可以用break
退出while循环.
如何退出if.@H_301_3@
Delphi中有一种GOTO吗?@H_301_3@
procedure ...
begin
if .... then
begin
here the code to execute
if (I want to exit = TRUE) then
break or GOTO
here the code not to execute if has exited
end;
here the code to execute
end;
您可以使用例外.
在内部if或循环中调用Abort,并在需要继续的地方捕获EAbort异常@H_301_3@
procedure ...
begin
try
if .... then
begin
(* here the code to execute *)
if I_want-to-exit then Abort;
(* here the code not to execute if has exited *)
end;
except on E: EABORT do ;
end;
(* here the code to execute *)
end;
原文链接:https://www.f2er.com/delphi/101728.html