delphi - 从 Delphi 中的 "if"退出

标签 delphi

您可以使用 break 退出 while 循环。

如何从 if 退出。

Delphi中有一种GOTO吗?

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;

最佳答案

喜欢Piskvor mentioned ,使用嵌套的if语句:

procedure Something;
begin    
  if IWantToEnterHere then
  begin
    // here the code to execute    
    if not IWantToExit then
      // here the code not to execute if has exited
  end;    
  // here the code to execute
end;

关于delphi - 从 Delphi 中的 "if"退出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11685841/

相关文章:

delphi - 名称/值对上的 TStringList CustomSort 方法

.net - 在Delphi中销毁COM对象

multithreading - 具有 WriteProcessMemory 的线程

delphi - 没有主图标的服务应用程序

delphi - delphi 5 中未找到 strutils.dcu

delphi - 无法检查类是否已创建

delphi - 何时销毁选项类型内的对象?

arrays - 用 TArray<XXX> 替换 XXX 数组是否安全

Delphi:如何计算大文件的 SHA 哈希值

delphi - 在lazarus或delphi中调整图像大小?