Computer Language/유니티

goto문 2중 for문에서 합의하에 사용가능

알 수 없는 사용자 2014. 4. 21. 20:43

using UnityEngine;

using System.Collections;


public class Chapter5 : MonoBehaviour {


// Use this for initialization

void Start () {

int i = 0, j = 0, count = 0;

for(i = 0; i < 5; i++){

for(j = 0; j < 5; j++){

count += 1;

if(count > 20)

goto EXIT_FOR;

}

}

print ("end of for");

EXIT_FOR:

print (count +", i =" + i + ", j=" + j);

}

// Update is called once per frame

void Update () {

}

}