11-20-2011 02:58 AM
Hi, I want to get some variable data which will varying within the for loop with changing each iteration. I want to use those varying data to control another loop simultaneously. I have trying by converting those variable into local variable. But, I can not get data from local variable from the outside of for loop. I get data from local variable only when loop has finished. In case of using while loop, I can get variable data from outside the loop. I don't know how I can do solution of this problem. Please suggest me. Thank you very much.
11-21-2011 10:02 AM
If you cannot read a local variable in another loop, you have made a large mistake in your program. Attach your code.
07-18-2013 02:56 PM
Hi
I was trying to do the same thing, access a variable in a for loop outside the for loop and before it is done executing.
I tried local variables which did not work, so I used a global variable and it works fine.
I am just curious about what u mentioned...is therre any drawbacks to using global vs local variables?
The reason i need this is that my for loop will run 100 times, and i need the data every 10 iterations,so on iteration 10, 20, 30,...
I cannot wait for the for loop to finish, so I need to have immediate access to the variable.
Thanks!!
07-18-2013 05:21 PM
developer001 wrote:The reason i need this is that my for loop will run 100 times, and i need the data every 10 iterations,so on iteration 10, 20, 30,...
This is sounding like you should be using a queue instead. That way you don't miss any data in case a process starts to lag for whatever reason.