博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
switch
阅读量:4541 次
发布时间:2019-06-08

本文共 1045 字,大约阅读时间需要 3 分钟。

using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace ConsoleApplication4{    class Program    {        static void Main(string[] args)        {            const string myName = "karli";            const string sexyName = "angelina";            const string sillyName = "ploppy";            string name;            Console.WriteLine("What is your name?");            name = Console.ReadLine();            switch(name.ToLower())            {                case myName:                    Console.WriteLine("You have the same name as me!");                    break;                case sexyName:                    Console.WriteLine("My,what a sexy name you have!");                    break;                case sillyName:                    Console.WriteLine("That's a very silly name.");                    break;            }            Console.WriteLine("Hello {0}!", name);            Console.ReadKey();        }    }}

 

转载于:https://www.cnblogs.com/cn-blog-cn/p/5136775.html

你可能感兴趣的文章
C++ 智能指针
查看>>
IOS7 position:fixed 定位问题
查看>>
12.伪类选择器与伪元素的应用
查看>>
Oracle存储过程基本语法
查看>>
JS高程第八章 BOM
查看>>
python-vi
查看>>
Unix进程控制
查看>>
DNS解析过程详解
查看>>
51Nod 1181 质数中的质数(质数筛法)
查看>>
并发编程学习总结
查看>>
Xamarin.Android 上中下布局
查看>>
VS Code使用记录
查看>>
locust参数化(数据库取值)
查看>>
Google Protocol Buffers浅析(三)
查看>>
.net core 中使用Google的protoc
查看>>
Spring Cloud和Spring Boot的区别
查看>>
jquery实现图片上传前本地预览
查看>>
C# — 题库答案汇总
查看>>
docker居然需要3.10以上的内核
查看>>
Win10下安装zookeeper
查看>>