OtsoSilver

Untitled

Sep 18th, 2021
655
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class Spiski : MonoBehaviour
  6. {
  7.     List<string> friends = new List<string>();
  8.  
  9.     void Start()
  10.     {
  11.         friends.Add("Ваня");
  12.         friends.Add("Маша");
  13.         friends.Add("Артем");
  14.         friends.Add("Таня");
  15.         print(friends);
  16.         //System.Collections.Generic.List`1[System.String]
  17.  
  18.         print(friends[0]); //Ваня
  19.         print(friends[3]); //Таня
  20.         print(friends[4]); //ArgumentOutOfRangeException: Index was out of range.
  21.     }
  22.  
  23. }
  24.  
RAW Paste Data