본문 바로가기
C#

while 문

by JAESEONG LEE- developer 2022. 7. 20.

wile 문에 코드 블록을 이용하면 여러 문장의 코드를 반복해서 실행할 수 있습니다.

 

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
using System;
 
namespace While
{
    class MainApp
    {
        static void Main(string[] args)
        {
            int i = 10;
 
            while (i>0)
            {
                Console.WriteLine("i : {0}", i--);
            }
        }
    }
}
cs

 

'C#' 카테고리의 다른 글

for 문  (0) 2022.07.20
do while 문  (0) 2022.07.20
switch 문  (0) 2022.07.20
if문 중첩해서 사용하기 IfIf  (0) 2022.07.19
if, else, else if 분기문 IfElse  (0) 2022.07.19