概要
using UnityEngine; public class Example : MonoBehaviour { private void Awake() { var array = new[] { 0, 1, 2, 3, 4 }; // 1,2,3,4 foreach ( var value in array[ 1.. ] ) { Debug.Log( value ); } // 0,1,2,3 foreach ( var value in array[ ..4 ] ) { Debug.Log( value ); } // 1,2,3 foreach ( var value in array[ 1..4 ] ) { Debug.Log( value ); } // 1,2,3 foreach ( var value in array[ 1..^1 ] ) { Debug.Log( value ); } } }