# Function returning multiple values?

**URL:** <https://forum.kirupa.com/t/function-returning-multiple-values/167197>\
**Category:** flash\
**Created:** [October 26, 2005, 6:51am UTC](https://forum.kirupa.com/t/function-returning-multiple-values/167197 "2005-10-26T06:51:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![superprg](https://avatars.discourse-cdn.com/v4/letter/s/858c86/32.png) [@superprg](https://forum.kirupa.com/u/superprg)\
**Post date:** [October 26, 2005, 6:51am UTC](https://forum.kirupa.com/t/function-returning-multiple-values/167197/1 "2005-10-26T06:51:49Z")

</div>

How can I rewrite this code so that I get all the four values returned in the function each time it is called.

[AS]  
x=0;  
AverageShare=new Array();  
for(k=1;k\<=10;k++)  
{  
AverageShare=update();  
trace(AverageShare);  
trace("x = "+x);  
}  
function update()  
{  
x++;  
for(i=1;i\<=4;i++)  
return x+i;  
}  
[/AS]
