# Populating an array with a for loop?

**URL:** <https://forum.kirupa.com/t/populating-an-array-with-a-for-loop/316439>\
**Category:** Uncategorized\
**Created:** [November 21, 2010, 8:46pm UTC](https://forum.kirupa.com/t/populating-an-array-with-a-for-loop/316439 "2010-11-21T20:46:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bonassus](https://avatars.discourse-cdn.com/v4/letter/b/ea5d25/32.png) [@bonassus](https://forum.kirupa.com/u/bonassus)\
**Post date:** [November 21, 2010, 8:46pm UTC](https://forum.kirupa.com/t/populating-an-array-with-a-for-loop/316439/1 "2010-11-21T20:46:39Z")

</div>

I’m trying to create 4 MC’s, mc1, mc2, mc3 and mc4. Populate the arrray testArray with then and then trace testArrays’ contents so that that the output is:  
mc1  
mc2  
mc3  
mc4

do i have to treat mc like a string in order to concatenate it with the var i in the loop? that isn’t working.

```auto

var testArray:Array = new Array;

for(var i = 1; i < 4; i++){
var "mc"+i:MovieClip = new MovieClip;
testArray.push("mc"+i);
 trace(testArray*)
    }

```

If i don’t use the quotes around mc it also dosn’t work and asks for a semicolon before the plus.  
would someone show me how this is done?

Thanks!
