using System;

namespace Lesson03
{
    class Program
    {
        static void Main(string[] args)
        {
            // ========== if / else ==========
            Console.WriteLine("=== if / else ===");
            int score = 85;

            if (score >= 90)
            {
                Console.WriteLine("优秀");
            }
            else if (score >= 60)
            {
                Console.WriteLine("及格");
            }
            else
            {
                Console.WriteLine("不及格");
            }

            // 三元运算符
            string result = score >= 60 ? "及格" : "不及格";
            Console.WriteLine($"三元运算: {result}");

            // ========== switch ==========
            Console.WriteLine("\n=== switch ===");
            int day = 3;

            switch (day)
            {
                case 1:
                    Console.WriteLine("星期一");
                    break;
                case 2:
                    Console.WriteLine("星期二");
                    break;
                case 3:
                    Console.WriteLine("星期三");
                    break;
                default:
                    Console.WriteLine("其他");
                    break;
            }

            // ========== for 循环 ==========
            Console.WriteLine("\n=== for 循环 ===");
            for (int i = 0; i < 5; i++)
            {
                Console.WriteLine($"计数: {i}");
            }

            // ========== foreach ==========
            Console.WriteLine("\n=== foreach 循环 ===");
            string[] names = { "无言势", "VRChat", "字幕" };

            foreach (string name in names)
            {
                Console.WriteLine(name);
            }

            // ========== while 循环 ==========
            Console.WriteLine("\n=== while 循环 ===");
            int count = 0;
            while (count < 3)
            {
                Console.WriteLine($"while: {count}");
                count++;
            }

            // ========== do while ==========
            Console.WriteLine("\n=== do while ===");
            int n = 0;
            do
            {
                Console.WriteLine($"do while: {n}");
                n++;
            } while (n < 3);

            // ========== break 和 continue ==========
            Console.WriteLine("\n=== break 和 continue ===");
            for (int i = 0; i < 10; i++)
            {
                if (i == 3) continue;  // 跳过 3
                if (i == 7) break;    // 退出循环
                Console.WriteLine(i);
            }

            Console.ReadLine();
        }
    }
}
