21 posts
Posted 25 January 2016 - 07:35 AM
how can i run 2 while true do at same time?
7083 posts
Location
Tasmania (AU)
Posted 25 January 2016 - 10:42 AM
Ah, now there's the sort of question that needs a lot more context wrapped around it - for starters, "same time" as in "nesting", or same time as in "multitasking"?
I'll guess the latter, in which case the best answer is usually "merge the code for the two loops into one".
If you don't want guesses, provide more information - such as the script to which your question applies.
1715 posts
Location
ACDC Town
Posted 25 January 2016 - 11:38 AM
The parallel API can be used for that, I suppose. Put each loop into its own function (say, 'foo()' and 'bar()'), then do:
parallel.waitForAny(foo,bar)
They will run until one of them returns.