C# 자리표시자

RudinP·2023년 3월 30일
0

Study

목록 보기
16/225

Console.WriteLine(a + " + " + b + " = " + a+b);
Console.WriteLine("{0} + {1} = {2}", a, b, a+b);
둘은 같다.

Console.WriteLine("{1},{0}", "a", "b") -> b,a 로 출력
Console.WriteLine("{0},{0}", "a", "b") -> a,a 로 출력
Console.WriteLine("{0},{1},{2}", "a","b") -> 에러

번외로
Console.WriteLine($"{a+b}"); 도 동일
Console.WriteLine($"{a}??{b}"); -> a??b 로 출력

profile
곰을 좋아합니다. <a href = "https://github.com/RudinP">github</a>

0개의 댓글