What's the difference between a Timer and using a while loop?
Moderator: Pulover
What's the difference between a Timer and using a while loop?
And what scenarios would I want to use each?
Re: What's the difference between a Timer and using a while loop?
Basically a while loop is a CPU time consuming task, it means your code is always running inside the loop.
A Timer uses internal chronos of your PC, if you program a timer for 1 second, CPU is free to do other tasks and when reach 1 second, your app receives a message that makes your code to be executed.
While loop says to the computer: "while this condition is true, do those instructions"
A Timer says to the computer: "Whenever a fixed time pass, call me"
Personally, If I can use a Timer, I won't use a while loop.
A Timer uses internal chronos of your PC, if you program a timer for 1 second, CPU is free to do other tasks and when reach 1 second, your app receives a message that makes your code to be executed.
While loop says to the computer: "while this condition is true, do those instructions"
A Timer says to the computer: "Whenever a fixed time pass, call me"
Personally, If I can use a Timer, I won't use a while loop.
Return to “Pulovers Macro Creator”
Who is online
Users browsing this forum: No registered users and 4 guests