I'm procedurally creating an array - for the sake of the example let's say:
int a={0,4,4,10}
From this I want to create a new array that is populated with the current element from a, plus the previous element from the new array - if element 0 there would be no addition and its populated like-for-like.
so in the example:
0 = 0 (a[0]) 1 = 4 (a[1]+newArray[0]) 2 = 8 (a[2]+newArray[1]) 3 = 18 (a[3]+newArray[2])
so:
newArray = {0,4,8,18}
My understanding is i cant do this inside a single vex for-loop in an attribute wrangle because newArray doesn't exist to access the previous value until the full loop is complete?
As a workaround I've instead used a For-Loop with feedback node and created the array on each iteration - My question - is this the only way/best to do it or am I missing something obvious?
Thank you.