Showing results for 
Search instead for 
Did you mean: 

how to give a selection from a while loop outpu such that it will not iterate

I'am attaching one program in which I used a while loop to give commands one by one from a arrray. I need to take reply for the last command , which when equal to itself the loop should stop iterating. how to do such a thing. Here outside signal such that only the loop should iterate can you please help

0 Kudos
Message 1 of 4

Point 1 - it's a for loop you've got there not a while loop, so it will stop when it runs out of indexing items

Point 2 - the code is a little messy, and it's not easy to see what you're doing in there


If you use a while loop it might help, but also what happens if the last command isn't equal to itself? Back to the start of the array? Keep resending the last command? Those things make a difference to how you need to code this.

0 Kudos
Message 2 of 4

Why are you closing your VISA port within each iteration of your For Loop?

0 Kudos
Message 3 of 4

Yeh i'am using A for loop, in it, I want to put this for loop in a while loop so that it will iterate until I push the stop button. But I need to stop this  for loop once the 28 equality happens.And when I press the second button it should take the command array from the case loop. i'am sending that program

0 Kudos
Message 4 of 4