# Adding previous value with current one in array

**URL:** <https://forum.kirupa.com/t/adding-previous-value-with-current-one-in-array/305847>\
**Category:** Uncategorized\
**Created:** [March 4, 2010, 1:40pm UTC](https://forum.kirupa.com/t/adding-previous-value-with-current-one-in-array/305847 "2010-03-04T13:40:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![black\_pearl](https://avatars.discourse-cdn.com/v4/letter/b/aeb1de/32.png) [@black\_pearl](https://forum.kirupa.com/u/black_pearl)\
**Post date:** [March 4, 2010, 1:40pm UTC](https://forum.kirupa.com/t/adding-previous-value-with-current-one-in-array/305847/1 "2010-03-04T13:40:55Z")

</div>

I have an array of numbers and I want to add the numbers and return an array of addition value  
My Array looks like

```auto
var optionYPos:Array=new Array(0,10,20,40);

```

I want the result as  
0,10,30,70

Just adding the previous value with the current one.

Please help me with this
