請先練習課本 中斷指令 continue 基本演練題
【說明】
1. continue 只能使用在 for、while、do while 之內.
2. continue 指令會使目前程序跳到迴圈運算式判斷處.
註:很多教材寫 continue 會跳到最前處,是比較不明確的說法.
【問題目標】
如何使用 break 離開迴圈
【程式碼說明】
#include <stdio.h>
#include <stdlib.h>
int main() {
int x=0,y=-1,s=2;

}
【程式碼說明】
#include <stdio.h>
#include <stdlib.h>
int main() {

}
學習重點:
1.在迴圈內 continue 通常必須有條件離開,否則 continue 以後的敘述等同無效。
2. continue 為非結構化指令,請勿過度或任意使用在迴圈內。
3. 在迴圈內適當使用 continue 可以提升迴圈執行效能。