rpr wrote:
i feel while loop to be much faster than for loop.Is that true?
No, they both run at basically the same speed given the same conditions. If anything, the while loop will run a bit slower because it has a condition to evaluate with every iteration.
The basic rule is simple - you use a for loop if you want to run a known number of times. Otherwise, you use a while loop. There is one exception and that's using the conditional terminal on the for loop. You can see some details
here.
There are two performance enhancments which a for loop can have - because it is run a known number of times it can have the memory for its outputs preallocated (which makes a big difference) and on certain occasions it can be computed before the VI runs.
___________________
Try to take over the world!