不知道 object pascal 语言中有没有类似于 c 中的loop,谢谢指教!
 
L1:     j=0;
        ......
        ......
        goto L1;

解决方案 »

  1.   

    The syntax of a repeat statement isrepeat statement1; ...; statementn; until expressionwhere expression returns a Boolean value. (The last semicolon before until is optional.) The repeat statement executes its sequence of constituent statements continually, testing expression after each iteration. When expression returns True, the repeat statement terminates. The sequence is always executed at least once because expression is not evaluated until after the first iteration.Examples of repeat statements includerepeat
      K := I mod J;
      I := J;
      J := K;
    until J = 0;
    repeat
      Write('Enter a value (0..9): ');
      Readln(I);
    until (I >= 0) and (I <= 9);
      

  2.   

    delphi也有goto的label 100
    //........
    100:
    //..............
    goto 100;
      

  3.   

    晕!
    goto是下下策。
    我记得书上应该说过,
    已经证明了所有的循环都可以用if while repeat之类的语句完成,
    应该从算法上考虑清楚,
    而不是用goto来弥补。
      

  4.   

    回复人: CentaurCao(草原) ( ) 信誉:94  2005-05-20 23:16:00  得分: 0  
     
     
       晕!
    goto是下下策。
    我记得书上应该说过,
    已经证明了所有的循环都可以用if while repeat之类的语句完成,
    应该从算法上考虑清楚,
    而不是用goto来弥补。
      
     
    没有必要,尽管理论上来说所有的goto都可以用三种方式完成
    但如果一个goto能完成的功能可能要许多的分支、循环来完成
    在不影响可读性的情况下,可以使用goto
    完成没有为了避免使用goto而去做其它的一堆事情