Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class Array : MonoBehaviour
  6. {
  7. private int[] intArray = new int[5];
  8.  
  9. private void Start()
  10. {
  11. for (int i = 0; i < intArray.Length; i++)
  12. {
  13. intArray[i] = i + 1;
  14. }
  15.  
  16. int j = 0;
  17. while (j < intArray.Length)
  18. {
  19. intArray[j] = j + 1;
  20. j = j + 1;
  21. }
  22.  
  23. foreach (int i in intArray)
  24. {
  25. intArray[i - 1] = i;
  26. }
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement