Duplicate: Referencing previous value of same array

I'm trying to set an array where values (except for the i = 0 value) are dependant on the previous value in the array. So something like the following:

test = IIF(barindex != 0, IIF(ref(test,-1) == 0, 1, 0), 0);

I have been able to write a loop solution to define the array but I was wondering if anyone has an array based solution that mimics what I'm trying to say in the above expression.

Thank you!


This has been already discussed in: