This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace ForEach | |
{ | |
class MainApp | |
{ | |
static void Main(string[] args) | |
{ | |
int[] arr = new int[] { 0, 1, 2, 3, 4 }; | |
foreach (int a in arr) | |
{ | |
// C#에서는 foreach(a in b){} 로 사용 | |
Console.WriteLine(a); | |
} | |
goto JUMP; | |
// goto X; 를 선언 하면, 바로 X로 건너감. | |
for (; ; ) | |
// for 매개변수에 아무것도 넣지 않고, (;;) 하면, 무한 루프문 | |
{ | |
Console.WriteLine("kkkk"); | |
} | |
JUMP: Console.WriteLine("kkkk"); | |
// X: 실행문; 을 지정하여 사용(텔레포트 개념). 단, 가독성 떨어지므로 사용 멀리하기. | |
} | |
} | |
} |
반응형
'Programming > C# - Window' 카테고리의 다른 글
C#/ 오버로딩·매개변수 사용 (0) | 2023.06.28 |
---|---|
C#/ 한정자 (0) | 2023.06.27 |
C#/ Switch 식 (1) | 2023.06.27 |
C#/ Null 연산자 (0) | 2023.06.27 |
C#/ 문자열 서식 (1) | 2023.06.27 |