04-11-2017 09:57 AM
Hello,
I have a simple while loop that allows the user to chose the number of iterations. In every iteration, I have a string that shows a constant name (ABC). So in the first iteration, the indicator will show ABC0, 2nd iteration ABC1, 3rd iteration ABC2 and so on. Now I want the last iteration to add a constant name (bgd) to the end of the first part (ABC).
So let's say the user chooses 3 iterations. I want the code the show the followings:
ABC0, ABC1, ABC2, ABC3bgd
However I don't know how to program this since the user has the power to choose the number of events. I have attached this simple code here.
Any help is greatly appreciated.
Solved! Go to Solution.
04-11-2017 10:08 AM
If you know the number of iterations beforehand, a FOR loop is often a better option than a WHILE loop.
Haven't looked at the code yet, but it seems odd to enter THREE iterations, to produce FOUR names.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
04-11-2017 10:21 AM
Now I want the last iteration to add a constant name (bgd) to the end of the first part (ABC).
So let's say the user chooses 3 iterations. I want the code the show the followings:
ABC0, ABC1, ABC2, ABC3bgd
This is not consistent. if you want THREE iterations, then BY DEFINITION, your last one is iteration TWO.
That's the rule.
However, here's something to produce the result you asked for:
Blog for (mostly LabVIEW) programmers: Tips And Tricks
04-11-2017 10:28 AM - edited 04-11-2017 10:29 AM
If you know how many iterations you are doing, you just do a comparison with the i terminal to see if you are on the last iteration. If you are, add your extra string.