?. : 존재하지 않는 객체의 속성에 접근하면 TypeError가 아닌 undefined를 반환
?? : 어떠한 값이 null이라면 대체
string apple = null;
string taste = apple ?? "맛있어";
// 맛있어
string apple = "맛없어";
string taste = apple ?? "맛있어";
// 맛없어
'Unity > 잡학 사전' 카테고리의 다른 글
[Unity/Animator] RuntimeAnimatorController, AnimatorOverrideController (1) | 2023.02.24 |
---|---|
batch (0) | 2023.02.23 |
return, break (0) | 2023.02.01 |
[Unity] Singleton (0) | 2023.01.15 |
[Unity] 물체 회전 (0) | 2023.01.12 |