program.cs

来自「c#开发宝典 光盘内容。本光盘主要为书中的源程序」· CS 代码 · 共 32 行

CS
32
字号
using System;
using System.Collections.Generic;
using System.Text;

namespace Example4_9 {
    class Program {
        static void Main(string[] args) {
            int[] myArray = new int[5] { 12, 9, 35, 68, 51 };
            int a = 0;

            //创建一个while循环,只要a小于5,就会执行。
            while (a < 5) {
                //当a等于2时,使得a自增1。
                if (a == 2) {
                    a++;
                    continue;
                }

                //当a等于4时,跳出循环。
                else if (a == 4) {
                    break;
                }

                Console.WriteLine("myArray[{0}]的值为{1}。", a, myArray[a]);
                a++;
            }

            Console.ReadLine();
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?