switch 문

using UnityEngine;
using System.Collections;

public class MouseClickTest : MonoBehaviour {

   public int myScore = 50;

// Use this for initialization
void Start () {

}

void OnMouseDown(){
myScore = myScore - 10;

switch (myScore) {
case 10: // myScore 10인경우 아래 구문 실행
print("failed");
break; //구문의 끝
case 20:
print("20");
break;
case 30:
print("30");
break;
case 40:
print("40");
break;
default : // case가 지정되지 않은 기본값
print("50");
break;
}

}



// Update is called once per frame
void Update () {


}
}

댓글

이 블로그의 인기 게시물

날짜 시간 시간차 시간 계산 하기

코루틴에서 CallBack 함수 적용하기

C++ 언어 퍼센트 구하는 방법 / 기본 언어 퍼센트 구하는 방법