C#编程--流程控制switch case

来源:互联网 发布:知世故而不世故出自哪 编辑:程序博客网 时间:2024/06/11 01:41

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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
           //流程控制 switch case

            int age = 1;
            switch (age)
            {
                case 1:
                    Console.WriteLine("1");
                    break; //没有这个语句无法编译通过
                case 2:
                    Console.WriteLine("2");
                    break;
                default:
                    Console.WriteLine("default");
                    break;
            }
           



            Console.ReadKey();
        }
    }
}
 

本文出自 “Kenan_ITBlog” 博客,请务必保留此出处http://soukenan.blog.51cto.com/5130995/1076216