Answered
Sum of an array
Hey guys,
So I have an array with six values stored in them.
The values will either be 1 or 0.
I need to sum them up so that I get a number ranging from 0-6.
Any help on this rather noob question would be much appreciated!
Hey guys,
So I have an array with six values stored in them.
The values will either be 1 or 0.
I need to sum them up so that I get a number ranging from 0-6.
Any help on this rather noob question would be much appreciated!
just loop thru the array and add them up...
var arraySum:Number = 0;
for (var i:uint=0; i< yourArray.length; i++){
arraySum += yourArray;
}
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.