I'm incrementing a given value in cycle limit of say 6. I'm curious how we can make this code shorter.
function Cycle_Value(inc_value:Number = 5, times:Number = 3):Number
{
var return_value:Number = inc_value;
while(times >= 1)
{
if(inc_value < 6)
{
inc_value++;
return_value = inc_value;
}
else if(inc_value == 6)
{
return_value = 1;
inc_value = 1;
}
else
trace(inc_value+" is out of bounds");
times--;
}
return return_value;
}
Sample Output: Cycle_Value(5,2) = 1, Cycle_Value(6,10) = 4