07-08-2008 05:14 AM
07-08-2008 10:25 AM
@DavidU wrote:
Hi,
Good Article - I'm just starting to use these.
Just one comment:
The two for loops in Example 2 - searching an array - will give different outputs if there is more than 1 match in the array. The first will give the index of the last matched element and the second will give the first matched element.
Dave
07-08-2008 10:27 AM
Hi JB,
@JB wrote:
Hi Jim,
Yes, your comments are right ! Please consider this example like a dirty code with the sole goal to avoid me to try to explain what I mean in a poor English.
However, IMHO, the revised comparison would be interesting because it shows how the for loop with conditional terminal makes things easier. Indeed, with previous versions of LabVIEW, you must :Your article illustrates the second case very well. But some programers - like me - may use the other one. So, this additional comparison may help and encourage these programers to switch from the while loop to the for loop with condition terminal.
- either use a while loop with some additionnal code to stop the loop at the last element of the array
- or put an empty case in a for loop to exit the loop as fast as possible when a condition occurs.
Cheers
07-08-2008 10:45 AM
Jim Kring a écrit:
BTW, there's a bug in my code too (see my previous post in this thread) 😉
07-08-2008 11:06 AM
🙂
@JB wrote:
Jim Kring a écrit:
BTW, there's a bug in my code too (see my previous post in this thread) 😉
Errare humanum est !