annulla
Visualizzazione dei risultati per 
Cerca invece 
Intendevi dire: 

stop while loop after last element of array

Risolto!
Vai alla soluzione

I want to stop a while loop after the last element of an array. I cant use the array size way because the size of the array can change within the program.  What should I do?

0 Kudos
Messaggio 1 di 7
7.058Visualizzazioni

Use a For Loop with autoindexing?

 

Does it have to be a While Loop?

Messaggio 2 di 7
7.055Visualizzazioni

Taki1999 mentioned 'For Loop' already. You can activate also the 'Conditional Terminal' of the For Loop, if you need to stop the loop because of any additional condition, like Boolean value, etc...

0 Kudos
Messaggio 3 di 7
7.039Visualizzazioni
And of course you can use array size to stop the loop. The for loop is the smart thing to use but a simple comparison between the array size and the iteration count can be used.
0 Kudos
Messaggio 4 di 7
7.021Visualizzazioni
Soluzione
Accettato da fghfghgfhfhg

Why don't you use the empty array function like this...?

2015-07-30 18_02_48-G15-0440.vi Block Diagram on ABT.lvproj_My Computer rev. 36 _.png

0 Kudos
Messaggio 5 di 7
6.932Visualizzazioni

@Jimmy.chretien wrote:

Why don't you use the empty array function like this...?

2015-07-30 18_02_48-G15-0440.vi Block Diagram on ABT.lvproj_My Computer rev. 36 _.png


I'm not sure the OP meant to stop the loop when the array is empty.  I think they want to stop it after the least element was processed.  At any rate, generally use a for loop if you know the size of the array ahead of time, a while loop if you do not.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Messaggio 6 di 7
6.920Visualizzazioni

Ok Thanks guys

0 Kudos
Messaggio 7 di 7
6.846Visualizzazioni