在DElphi中定义goto 标号的方法是什么?????

解决方案 »

  1.   

    label
      ss;
    begin
      goto ss;
      ....
      ss:
        ...
    end;
      

  2.   

    var
    i;integer;label  a;
    begin
      
      ....
      a:
        ...  goto a;
    ....
    end;
    label标号的第一个字符要用英文字母,程序中要少用goto语句,但如程序简单用了就便于理解
      

  3.   

    方法是在procedure或者function和begin之间加入label label1;和var、const一样
    然后在begin和end之间加入到要跳转的位置即可,一旦声明必须使用,否则编译不通过。一般在复杂的循环中使用。
    procedure mypro1();
    var ....;
    const ....;
    label label1;
    begin
     ....
     if ... goto label1
    ...
    label1:
    ....
    end;
      

  4.   

    方法是在procedure或者function和begin之间加入label label1;和var、const一样
    然后在begin和end之间加入到要跳转的位置即可,一旦声明必须使用,否则编译不通过。一般在复杂的循环中使用。
    procedure mypro1();
    var ....;
    const ....;
    label label1;
    begin
     ....
     if ... goto label1
    ...
    label1:
    ....
    end;