유니티

[C#] 배열

simstealer 2022. 7. 7. 10:52
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class HelloCode : MonoBehaviour
{
    void Start()
    {
        int[] student = new int[5]; // 자료형 앞에 [] 대괄호를 써서 배열이란걸 알려주자

        student[0] = 1;
        student[1] = 2;
        student[2] = 3;
        student[3] = 4;
        student[4] = 5;

        for (int i = 0; i < student.Length; i++)
        {
            Debug.Log(student[i]);
        }
    }

}