跳轉至內容

初學者教程之迴圈

來自維基百科,面向廣闊世界的開放書籍
  while (myInt < 10){
           // do things...
           myInt++;
       }

do 迴圈類似於 while 迴圈,但它始終至少執行一次。

do {
           // do things...
       }  while (myVar != false);


 for (int i=0; i < 10; i++){
           if (i == 10)
               break;
           if (i % 2 == 0)
               continue;
           // do things
       }
華夏公益教科書