請問Delphi 有沒有像 C 的break一樣可以跳出迥圈的Keyword呢? |
答題得分者是:christie
|
chkkevin
一般會員 發表:34 回覆:64 積分:19 註冊:2007-05-17 發送簡訊給我 |
|
christie
資深會員 發表:30 回覆:299 積分:475 註冊:2005-03-25 發送簡訊給我 |
請問Delphi 有沒有像 C 的break一樣可以跳出迥圈的Keyword呢?
Ans:在PASCAL(Delphi)也叫 break break Causes the flow of control to exit a for, while, or repeat statement. ===================================================================== var i : Integer; s : string; begin s := ''; // A big loop for i := 1 to 10 do begin s := s IntToStr(i) ' '; // Exit loop when a certain condition is met if Random(4) = 2 then Break; end; ShowMessage('i = ' IntToStr(i)); ShowMessage('s = ' s); end; ref: http://www.delphibasics.co.uk/RTL.asp?Name=Break
------
What do we live for if not to make life less difficult for each other? |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |