Instantiate object in for loop with array

So i am instantiating a GameObject which works just fine. Now i want to be able to save different instances of that GameObject and save those in an array and then display those via a for loop. For some reason My for loop isnt even executed.
here is the Code:

for(var i : int = 0; i <= eventsArray.length-1; i++){
			print("i: "+i);
			DayDisplayInstance = Instantiate(DayDisplay, new Vector3(56.39999, -222.8), transform.rotation);
			DayDisplayInstance.transform.SetParent(startScreenPnl.transform, false);
			DayDisplayInstance = eventsArray*;*
  •  	child = DayDisplayInstance.transform.GetChild(0).gameObject;*
  •  	myText = child.GetComponent.<Text>();*
  •  	myText.text = "MO"; 											//Add variable instead of MO to make the event flexible*
  •  }*

If i Instantiate and add to the array outside of the loop it workds but that ofc will not allow me to instanciate multiple times in that one function, that’s why i want to do it in the for loop.
My guess would be that the array is size 0 in the beginning and nothing is being added untill after the for loop. So the for loop says it starts at 0 and ends at array.length which since the array is empty is also 0. This results in the code in the for loop not being executed. How would i fix this? Any ideas?
Anything would be much appreciated!
Thanks in advance!
(the Vector3 is only for testing for now. My thought would be to make an array with vectors and then looping through that with i as well to display those GameObjects in the right position.

EDIT: Actually, it will not just not execute your code, but it will also crash Unity and cause massive memory consumption over time. @Harinezumi had already mentioned about it.

@Romano’s answer works fine, but it needs a little bit of fix as that in itself may cause bugs later on. Here’s what I’ve noticed so far:

  1. Is eventsArray even an array? You’re using its length property (which exists on arrays and not Lists) but then you’re also using Add, which only is possible if it’s a generic List.

  2. You’re adding items to eventsArray while accessing its actual length, which means this will continue to loop forever and ever.

Workaround: Just create a temporary variable to store the previous length of the list, then use that in your for loop.

var length = eventsArray.Count;
for(var i : int = 0; i < length; i++){
//...your code here

Somewhere in your code, (since you want to use Add), eventsArray should be declared as a List:

import System.Collections.Generic;

public var eventsArray : List.<GameObject>;

And initialize it like this:

eventsArray = new List.<GameObject>();

I think if you change this line

  for(var i : int = 0; i <= eventsArray.length-1; i++){

to read

 for(var i : int = 0; i <= 5; i++){

where 5 is the number of game objects you want to instantiate it should run. You would just replace the number 5 with whatever variable you want if the loop number needs to be dynamic.