# Simple function but..., variable + array

**URL:** <https://forum.kirupa.com/t/simple-function-but-variable-array/148747>\
**Category:** flash\
**Created:** [May 23, 2005, 9:05am UTC](https://forum.kirupa.com/t/simple-function-but-variable-array/148747 "2005-05-23T09:05:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![onetwo](https://avatars.discourse-cdn.com/v4/letter/o/3d9bf3/32.png) [@onetwo](https://forum.kirupa.com/u/onetwo)\
**Post date:** [May 23, 2005, 9:05am UTC](https://forum.kirupa.com/t/simple-function-but-variable-array/148747/1 "2005-05-23T09:05:13Z")

</div>

Hi  
Today I have:

for (condition){  
//Income  
if (\_global.chart\_no==1){  
current\_value= \_global.income\_md;// \_global.income\_md is an array  
}  
//Costs  
if (\_global.chart\_no==2){  
current\_value= \_global.costs\_md;// \_global.costs\_md is an array  
}  
//Profit  
if (\_global.chart\_no==3){  
current\_value= \_global.profit\_md;// \_global.profit\_md is an array  
}

}

In stead I would like something outside the for condition making it variable what array is to be selected:

work\_with\_this\_alue=current\_value + \*;

How is the last line to be written in order to create this flexibility ?

Best regards
