01-16-2014 01:55 AM - edited 01-16-2014 02:01 AM
Should we expect this type of result in "Array"?
My guess it should be the inverted version of "Array 2".
----------------
I've corrected it by placing shift register on the tunnels.
Please remove the post sorry.
01-16-2014 02:13 AM
The behaviour is entirely expected.
On your first iteration, you replace the 0th element of the initialised array. On your second iteration, you replace the 1st element of the initialised array, rather than the result of the replace array primitive from the previous iteration.
Change the tunnels of the for loop to shift registers, and you'll pass the result of the previous iteration to the current iteration.
If you change your initialise constant to True, or the array length to an odd number (but not both), you'll easily notice that when the for loop finishes, only the last element will be changed.
You can figure out 'bugs' like this (read: shortcomings in your code) via Highlight Execution and probing.
01-16-2014 02:59 AM
@gagikk wrote:
My guess it should be the inverted version of "Array 2".
I've corrected it by placing shift register on the tunnels.
With a shift register, you won't get an inverted version, both output arrays will be the same.
@gagikk wrote:
Please remove the post sorry.
No, posts like this should not be removed. Many new users will learn from this discussion in the future.
01-16-2014 05:53 AM
It's a classic mistake to manipulate arrays without shift registers, we've all done it. 🙂
/Y