LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Article - LabVIEW 8.5 Feature - For Loop Conditional Terminal

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 :
  • 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.
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.

Cheers
0 Kudos
Message 11 of 15
(936 Views)


@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


Dave: You're right.  Great catch!
0 Kudos
Message 12 of 15
(914 Views)


@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 :
  • 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.
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.

Cheers


Hi JB,

I agree that the While Loop comparison would be interesting.  Maybe I can add that in a follow-up article where I assimilate some of the great feedback (like yours) that has been given.

BTW, there's a bug in my code too (see my previous post in this thread) 😉

Cheers,

-Jim
0 Kudos
Message 13 of 15
(911 Views)

Jim Kring a écrit:

BTW, there's a bug in my code too (see my previous post in this thread) 😉


Errare humanum est !

0 Kudos
Message 14 of 15
(902 Views)


@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 !



🙂
0 Kudos
Message 15 of 15
(894 Views)