# 디버깅 (대소문자 주의)
Debug.Log("Hello Unity");
# 변수 세팅
int a;
float b;
string c;
bool d;
# 그룹형 변수 (배열, 리스트)
string[] monsters = {"","",""};
List<string> items = new List<string>();
items.Add("");
items.RemoveAt(0);
# 비교연산자
isFullLevel = level ==fullLevel;
bool isEndTutorial = level > 10;
bool isBadCondition = health <= 50 && mana <= 20; # And 연산자
bool isBadCondition = health <= 50 || mana <= 20; # Or 연산자
string condition = isBadCondition ? "나쁨" : "좋음";
# 조건문
if (true) {
}
else {
}
switch (파라미터) {
case "":
break;
default:
break;
}
# 반복문
while () {
}
for (int count = 0; count < 10 ; count++) {
}
foreach (string monster in mosters){
}
# 함수
int Heal(int health) # 반환할 타입을 명시해줘야함.
{
return health;
}
void Heal() # 함수가 반환할 데이터가 없다는 뜻
{
}
'프로그래밍 언어 > C#' 카테고리의 다른 글
[C#] Winform 모든 포커스 해제 (0) | 2022.09.05 |
---|---|
[C#] 웹페이지 값 가져오기 (0) | 2022.09.05 |
[C#] Yes No 버튼 | 확인 버튼 (0) | 2022.08.29 |
[C#] 명령 프롬프트 실행 (0) | 2022.08.26 |
[C#] C#에서 Python 실행하기 (0) | 2022.08.26 |
[C#] .ini 파일 읽기 쓰기 (0) | 2022.08.22 |
[C#] GUI 연습 | MetroFramework 적용 (0) | 2022.08.19 |