# How to pass variables from array to function?

**URL:** <https://forum.kirupa.com/t/how-to-pass-variables-from-array-to-function/294958>\
**Category:** flash\
**Created:** [August 23, 2009, 11:42am UTC](https://forum.kirupa.com/t/how-to-pass-variables-from-array-to-function/294958 "2009-08-23T11:42:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![joseek](https://avatars.discourse-cdn.com/v4/letter/j/f08c70/32.png) [@joseek](https://forum.kirupa.com/u/joseek)\
**Post date:** [August 23, 2009, 11:42am UTC](https://forum.kirupa.com/t/how-to-pass-variables-from-array-to-function/294958/1 "2009-08-23T11:42:37Z")

</div>

Hello, everyone!  
I’m facing a problem with passing variables from array to function.

Array example:

```auto

var Arr:Array= [[0, 1, 2, 3, false],[4, 5, 6, 7, true]];

```

Function example:

```auto

function passVar(var1:Number, var2:Number, var3:Number, var4:Number, var5:Boolean){
trace(var1+" "+var2+" "+var3+" "+var4+" "+var5)
}

```

if I do something like this:

```auto
passVar(Arr[0])

```

i get **0,1,2,3,false undefined undefined undefined undefined** in output, and I’m trying to figure out, how to properly pass variables from the array.  
Using this:

```auto
passVar(Arr[0][0], Arr[0][1], Arr[0][2], Arr[0][3], Arr[0][4])

```

works, but is there any shorter ways like passing the whole array of variables?  
Any help appreciated.  
Thanks.
