# Create variables with loop?

**URL:** <https://forum.kirupa.com/t/create-variables-with-loop/268656>\
**Category:** Uncategorized\
**Created:** [August 16, 2008, 9:05pm UTC](https://forum.kirupa.com/t/create-variables-with-loop/268656 "2008-08-16T21:05:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![REEF](https://avatars.discourse-cdn.com/v4/letter/r/ce73a5/32.png) [@REEF](https://forum.kirupa.com/u/REEF)\
**Post date:** [August 16, 2008, 9:05pm UTC](https://forum.kirupa.com/t/create-variables-with-loop/268656/1 "2008-08-16T21:05:01Z")

</div>

```auto
var labels:Array = new Array("label 1", "label 2");
for (var i:int = 0; i < 2; i++) {
   myItem+* = new ContentMenuItem(labels[0]);
   myItem+*.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, doSomething);
   myCustomMenu.customItems.push(myItem+*);  
}

```

Possible? I want variables to end up myItem0, myItem1, etc.
