Because in range and coerce would compare the first element of second row also. Here second row first element is 6 (not in range) so it returns 0 to the second row.
The second is not added at all. But the third, empty, row is added since the Index Array will return the default value (0), which does satisfy the In Range And Coerce. But since all rows must be the same size, the new row will be all 0.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions Unofficial Forum Rules and Guidelines "Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Just to clarify, since somehow I seem to have overlooked this crucial difference between while and for loops--
A for loop with a conditional terminal will stop execution (when the condition is met) immediately, mid-iteration, whereas a while loop will recognize that the condition is met but finish the current iteration, and then stop?
And side note: The Daily CLAD is an amazing resource. Having taken the CLAD before and failed because I was studying for the pre-2017 version (due to misinformation provided by my professor), I've learned a lot since finding this blog.
I would say the execution of FOR and WHILE loops is the same around the evaluation of the STOP Condition.
Both the FOR and WHILE will complete execution of the code for the current iteration (whatever is inside the looping structure) before checking the STOP condition.
NOTE: The FOR Loop may also stop due to the number of specified iterations being completed or by an auto indexing input tunnel reaching an empty array element.
If that is the case (that both FOR and WHILE will complete the current iteration before checking the stop condition), why is it that in alex's code snippet, that the result of the for loop does not include the row of zeros?
Because the value wired to the N on the FOR loop limits how many iterations the loop will perform. But to do that FOR loop properly, the array should be autoindexed, which would eliminate the need for the first Index Array. The FOR loop is smart enough that it will only iterate the number of rows in the array.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions Unofficial Forum Rules and Guidelines "Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Duh! For some reason I was thinking that the value wired to the count terminal of the FOR loop was large enough that the stop condition would return T first, before N was reached.
Obviously, the value wired to N is 2, meaning that the FOR loop will stop after i reaches a value of 1.
It's a miracle how something can make sense when you look at it in LabVIEW...
The first Array Index is getting the row. The comparison is being done only on the first element of the row. So your array element 5 is never checked.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions Unofficial Forum Rules and Guidelines "Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5