在while/for/repeat循环中:1. 有没有什么机制能够在循环体中间推出循环的?类似C/C++的break和Basic的Exit For或Exit Do。
2. 有没有什么机制能够在循环体中退出本次循环,进入下一次循环的?类似C/C++的continue小弟原本玩C/C++,最近要用Delphi,有些东西不太习惯。

解决方案 »

  1.   

    to  firstshine(原曦)
    你的三角是乍混来的?
    PASCAL:
    loop
    exit
      

  2.   

    to  cnhgj(戏子) 
     你也是用C的???
      

  3.   

    :::俄,找到了,不过发现它居然是过程,太土了::::
    你太土:
      loop 继续循环
      exit 退出一个循环
    -----虽然已结贴,不过我怀疑你在倒分,保留投诉权利------
      

  4.   

    To whoami1978(你也是程序员?)你不用管我的三角是怎么混来的,我只知道,我的答案没有错
    如果你不明白以下英文的意思,给我来信,我可以告诉你,免得你以后再丢人现眼:
    //=================================
    The Continue procedure causes the flow of control to proceed to the next iteration of the enclosing for, while, or repeat statement.The compiler reports an error if a call to Continue isn't enclosed by a for, while, or repeat statement.Note: Continue does not violate the flow of control dictated by a try..finally construct. If a call to Continue causes control to leave the try clause, the finally clause is entered.//=================================
    The Break procedure causes the flow of control to exit a for, while, or repeat statement and continue at the next statement following the loop statement.A call to Break must be contained in a for, while, or repeat statement, or the compiler reports an error.Note: Break does not violate the flow of control dictated by a try..finally construct. If a break occurs inside the try clause, the finally clause is entered.//=================================
    Loops allow you to execute a sequence of statements repeatedly, using a control condition or variable to determine when the execution stops. Object Pascal has three kinds of control loop: repeat statements, while statements, and for statements.
    You can use the standard Break and Continue procedures to control the flow of a repeat, while, or for statement. Break terminates the statement in which it occurs, while Continue begins executing the next iteration of the sequence.
    //=================================
      

  5.   

    To whoami1978(你也是程序员?)哦,忘记告诉你,exit的作用不是退出循环而是退出整个procedure或者function,告诉你,下课后把以下文字抄写100遍,抄不完不许睡觉。The Exit procedure immediately passes control away from the current procedure. If the current procedure is the main program, Exit causes the program to terminate.Exit will cause the calling procedure to continue with the statement after the point at which the procedure was called.Note: Exit passes control away from the current procedure, not merely the current block. But Exit does not violate the flow of control dictated by a try..finally construct; if Exit is called inside the try clause, the finally clause is still executed.
      

  6.   

    To whoami1978(你也是程序员?)哦,忘记告诉你,exit的作用不是退出循环而是退出整个procedure或者function,告诉你,下课后把以下文字抄写100遍,抄不完不许睡觉。The Exit procedure immediately passes control away from the current procedure. If the current procedure is the main program, Exit causes the program to terminate.Exit will cause the calling procedure to continue with the statement after the point at which the procedure was called.Note: Exit passes control away from the current procedure, not merely the current block. But Exit does not violate the flow of control dictated by a try..finally construct; if Exit is called inside the try clause, the finally clause is still executed.