# Declaring variables with a for loop?

**URL:** <https://forum.kirupa.com/t/declaring-variables-with-a-for-loop/316442>\
**Category:** Uncategorized\
**Created:** [November 21, 2010, 10:17pm UTC](https://forum.kirupa.com/t/declaring-variables-with-a-for-loop/316442 "2010-11-21T22:17:08Z")\
**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, 10:17pm UTC](https://forum.kirupa.com/t/declaring-variables-with-a-for-loop/316442/1 "2010-11-21T22:17:08Z")

</div>

I am new to programing.

I want to declare 8 variables at the class level like this:

```auto
     
private var graphicDesign1:Sprite;
private var graphicDesign2:Sprite;
private var graphicDesign3:Sprite;
private var graphicDesign4:Sprite;
private var graphicDesign5:Sprite;
private var graphicDesign6:Sprite;
private var graphicDesign7:Sprite;
private var graphicDesign8:Sprite;

```

But I would like to do it with a for loop. Is that possible? If so i’m doing it wrong this is what I have.

```auto

for(var i = 1; i < 9; i++){
            private var +"graphicDesign"+i:Sprite;
             }

```

Will someone show me the correct way to do this?

Thanks!
