본문 바로가기

C#문법 ( • ̀ω•́ )✧

C#문법-Console.WriteLine?(출력,이스케이프 시퀀스)

Console.WriteLine
C#에서 콘솔 출력을 할 때는 Console.WriteLine 메소드 사용,
WriteLine 메소드는 인수로 전달된 값을 출력하고 줄 바꿈(new line) 문자열을 추가(출력한 후 다음줄로 커서가 이동) 

형식

Console.WriteLine(Velue);
Velue ->문자열,숫자,변수,연산식등 어떤 값이든 사용가능
 

ex)

더보기

Console.WriteLine("Hello World!");

Console.WriteLine(2024);

출력▷Hello World!

          2024

 

Console.Write
Console.WriteLine 메소드와 유사하나,줄 바꿈 문자열을 추가하지 않음(출력한 후 다음 출력을 이어서 출력)

 
ex)

더보기
Console.Write("Hello!");

Console.Write("Happy New Year");

Console.Write("in 2024!");

 

출력▷Hello!Happy New Year in 2024!

 

이스케이프 시퀀스
문자열 내에 특별한 문자를 포함시키기 위해 사용되는 특별한 문자 조합