Ans is C. The array size is 4 and +1 will result in 5 (autoindexing will not change value of N). The value of N wil not change throughout the execution of the for loop.
I was going also for B, but YogeshShivarudrappa made a good point - I was not sure of the behavior of the N terminal output so I simulated the code to find out the correct results. It turns out that the output is 4, so the correct explanation should be the one given by BenoitP.
I know the behavior at the input node of the N terminal, that is what you correctly explained. I never thought about the output side of the terminal, whether it would take anyway the value directly wired to the input side or the minimum iteration value. This is what I wanted to check
Hi Stefano. you mentioned simulating the code. The majority of pictures in my posts are VI Snippets, you should be able to drag and drop a VI Snippet direct from your internet browser, to the LV Block Diagram (LV Version permitting), give it a go it is way coooooool.
Answer: B. Another awesome thread everybody. Special shout out to BenoitP for a nice explanation. I like to think of For Loop as being lazy, they always go for the smallest number of iterations from those defined. In addition I like to think of While loops as being dumb, they just keep going until the Conditinal terminal tells them to stop.
From the question; the value out of the N terminal is the number of iterations for the loop, not necessarily the value wired to the N Terminal.
thanks Steve, I will try for sure! It looks like something really nice to do!
Regarding the value out of the N terminal, I have noticed that it outputs the number of iterations for the loop already on the first iteration. It does not increase the value starting from '1' and update at each iteration. Just something I found out and I didn't know