循環中斷

using System;
using System.Collections.Generic;
using System.Text;

namespace @break
{
    class Program
    {
        static void Main(string[] args)
        {
            int i = 0;
            while (i < 12)
            {
                Console.WriteLine("i={0}", i);
                i++;
                if (i == 10)
                {
                    //break;  //跳出當前循環語句,執行while後面的代碼
                    continue; //跳出本次循環,繼續執行while循環
                }
                Console.WriteLine("當前i={0}", i);
            }
            Console.WriteLine("明白了嘛");
            Console.ReadKey();
        }
    }
}

發佈了32 篇原創文章 · 獲贊 1 · 訪問量 2萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章