[Xerte] sum part of array?

Dave Burnett d_b_burnett at hotmail.com
Tue Jul 26 14:50:15 BST 2011




Just out of curiosity, is there any way to sum part of an array?


[1,2,3,4,5]


Lets say I have an index variable and I always will want to sum from 0 to that variable.


pseudo
my_array.sum(0,var);


Or am I forced to loop + add?


Or any elegant way to create a temp array of the target elements and sum on that instead?


Dave




 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nottingham.ac.uk/pipermail/xerte/attachments/20110726/cee4c36d/attachment-0001.html>


More information about the Xerte mailing list