C#中的“\”、@、break、continue

来源:互联网 发布:超级淘宝txt全集下载 编辑:程序博客网 时间:2024/05/28 22:08

   c#中的“\”Console.WriteLine("C\:\");表示\转成\;而如果使用了@则表明不把\当成转义当成字符。

C#中的break表示跳出当前循环体,而且进行之后程序。

namespace breakContinue
{
    class Program
    {
        static void Main(string[] args)
        {
            int i = 0;
            while(true){
            
                if(i==5){


                    break;


                }
                Console.WriteLine(i);
                i++;
            }
            Console.WriteLine("break退出当前循环体退出了 继续执行后面的程序");
            Console.ReadKey();


        }
    }
}

continue表示跳出单次循环

 int x = 0;
            while (x++ < 10)
            {
                if (x == 3)
                {
                    continue;
                }
                Console.WriteLine(x);
            }
            Console.ReadKey();



0 0
原创粉丝点击