KO CSharp Keyword break - LIHACHTETAN/ClassicUO-Bad-Newbie-CSharp-Scripts-IDE GitHub Wiki
ะฃะบัะฐัะฝััะบะฐ ยท ะ ัััะบะธะน ยท English ยท Deutsch ยท Franรงais ยท Italiano ยท Espaรฑol ยท ็น้ซไธญๆ ยท ๆฅๆฌ่ช ยท ํ๊ตญ์ด
C#: break
ํธ๋๋ถ C# ยท ์ค์ฉ ๊ฐ์ด๋
๊ฐ์ฅ ๊ฐ๊น์ด ๋ฃจํ๋ ์ค์์น๋ฅผ ์ข ๋ฃํฉ๋๋ค. ์ ์ฒด ๋ฐฉ๋ฒ์ ์๋ฃํ์ง ์์ต๋๋ค.
๊ฐ๋จํ ์์ (Example.cs)
์ด ์์ ๋ฅผ Example.cs๋ก ๋ฐ๋ก ์ ์ฅํ๊ณ ์ด ํ์ด์ง์ ๋ค๋ฅธ ์์ ์ ๋
๋ฆฝ์ ์ผ๋ก ์คํํ์ธ์.
Example.cs:
// PROJECT-EXAMPLE
for (int i = 0; i < 5; i++)
{
if (i == 2) break;
System.Console.WriteLine(i);
}
๊ฒฐ๊ณผ:
0
1
ํต์ฌ๋ก
break;
์์ 1: ๊ธฐ๋ณธ ํํ
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.IO;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
public static class Program
{
public static async Task Main(string[] args)
{
foreach (int value in new[] { 1, 3, 7, 9 }) { if (value > 5) break; Console.WriteLine(value); }
}
}
์ 2: ๋ ๋ค๋ฅธ ์ค์ ํ์
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.IO;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
public static class Program
{
public static async Task Main(string[] args)
{
int state = 2;
switch (state) { case 1: Console.WriteLine("A"); break; case 2: Console.WriteLine("B"); break; }
}
}
๊ณต์ ์ถ์ฒ: Microsoft ํ์ต.