# Shortcut for the sum of array elements?

**URL:** <https://forum.kirupa.com/t/shortcut-for-the-sum-of-array-elements/280527>\
**Category:** Uncategorized\
**Created:** [January 28, 2009, 3:26pm UTC](https://forum.kirupa.com/t/shortcut-for-the-sum-of-array-elements/280527 "2009-01-28T15:26:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bhnh](https://avatars.discourse-cdn.com/v4/letter/b/eb8c5e/32.png) [@bhnh](https://forum.kirupa.com/u/bhnh)\
**Post date:** [January 28, 2009, 3:26pm UTC](https://forum.kirupa.com/t/shortcut-for-the-sum-of-array-elements/280527/1 "2009-01-28T15:26:06Z")

</div>

I have an array of twenty integers, and I’d like to find the sum of all the integers. The obvious way is

var sum:int = arr[0]+arr[1]+arr[2]… etc.

I’m wondering if there’s a shortcut way of adding the elements up? Many thanks.
