请问delphi中类似的goto语句是什么?我用save和goto为何提示不可识别

解决方案 »

  1.   

    procedure FindFirstAnswer;
    var 
      X, Y, Z, Count: Integer;
    label 
      FoundAnAnswer;
    begin
      Count := SomeConstant;
      for X := 1 to Count do
        for Y := 1 to Count do
          for Z := 1 to Count do
            if ... { some condition holds on X, Y, and Z } then
              goto FoundAnAnswer;
     
      ... {code to execute if no answer is found }
      Exit;
     
      FoundAnAnswer:
        ... { code to execute when an answer is found }end;
      

  2.   

    procedure TForm1.Button1Click(Sender: TObject);
    label
      1;
    begin
      ShowMessage('First. ');
      1: ShowMessage('Second. ');
      goto 1;
    end;