using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// 반복문
// for 문
// for (초기식; 조건식; 증감식)
// {
// 반복될 코드;
// }
// while 문
// while (조건식)
// {
// 반복될 코드;
// }
public class Test_1 : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
//int Num = 1;
//Debug.Log(Num);
//Num = 2;
//Debug.Log(Num);
//Num = 3;
//Debug.Log(Num);
//for (int ii = 1; ii <= 100; ii++) // 1~100 출력
//{
// Debug.Log(ii);
//}
// for 문 안에서 변수의 변화값 0 ~ 99 반복횟수 : 100번
//for (int a = 0; a < 100; a++)
//{
// Debug.Log(a);
//}
// for문 안에서 변수의 변화값 10 ~ 1 반복횟수 : 10번
//for (int xx = 10; xx > 0; xx--)
//{
// Debug.Log(xx);
//}
//Debug.Log("구구단 7단");
//for (int ii = 1; ii < 10; ii++)
// Debug.Log("7 * " + ii + " = " + (7 * ii));
// 이중 for문
//Debug.Log("구구단 2 ~ 9단 출력");
//for (int a_Dan = 2; a_Dan < 10; a_Dan++)
//{
// Debug.Log("구구단 " + a_Dan + "단");
// for (int idx = 1; idx < 10; idx++)
// {
// Debug.Log(a_Dan + " * " + idx + " = " + (a_Dan * idx));
// }
// Debug.Log("---");
//}
// 이중 for문
// while문
//int a_bb = 1;
//while (a_bb <= 10)
//{
// Debug.Log("a_bb : " + a_bb);
// a_bb++;
//}
// for문으로 바꾸기
//for (int bbb = 1; bbb <= 10; bbb++)
//{
// Debug.Log("bbb : " + bbb);
//}
// do ~ while 문
//int a_kk = 10;
//while(20 < a_kk)
//{
// Debug.Log("while문 a_kk = " + a_kk);
// a_kk++;
//}
//do
//{
// Debug.Log("do ~ while문 a_kk = " + a_kk);
// a_kk++;
//} while (20 < a_kk);
// 무한루프
int ABC = 0;
while (true) // 무한루프
{
ABC++;
if ((ABC % 2) == 0)
continue; // while문의 시작 위치로 돌아가는 키워드 (for문에서도 사용가능)
if (10 < ABC)
break; // while문을 즉시 빠져 나가는 키워드 (for문에서도 사용 가능)
Debug.Log("while 무한루프 테스트 : " + ABC);
}
// for문의 무한루프
ABC = 0;
for(; ; )
{
ABC++;
if((ABC % 2) == 1)
continue; // for문의 시작 위치로 돌아가는 키워드
if (10 < ABC)
break; // for문을 즉시 빠져 나가는 키워드
Debug.Log("for 무한루프 테스트 : " + ABC);
}
}
// Update is called once per frame
void Update()
{
}
}