safe break out of a while loop

This is where you talk about Macros, show examples of your macro scripting and SHARE handy segments of script code as examples.

safe break out of a while loop

Postby Battwell » Sun Nov 05, 2017 6:36 pm

what is the safest way of breaking out of a while loop
ie in case of an input led not being found when in while loop

i had a case today where my macro wasnt be able to be stopped
i have a wait 100 in it so it doesnt over run
Battwell
 
Posts: 174
Joined: Sun Sep 25, 2016 7:39 pm

Re: safe break out of a while loop

Postby Robertspark » Sun Nov 05, 2017 7:39 pm

What was the test?

Code extract of while + explanation

One way to do it is define a counter / timer and run that inside the while loop then return after the duration.

Really you don't want to run too many while loops unless you are waiting for something certain to happen.

Unless it's something like while is loading / stopped I try to stay away from it.... All depends upon what you want to do with it as there may be another way
Last edited by Robertspark on Sun Nov 05, 2017 7:47 pm, edited 1 time in total.
Rob

Einstein ― “If you can't explain it to a six year old, you don't understand it yourself”
UC400eth, UC300eth, UCCNC v1.2046, Neuron Lite.
UCCNC Macro Manual
Robertspark
 
Posts: 617
Joined: Sat Sep 03, 2016 4:27 pm
Location: Nr Liverpool, England

Re: safe break out of a while loop

Postby Robertspark » Sun Nov 05, 2017 7:46 pm

Rob

Einstein ― “If you can't explain it to a six year old, you don't understand it yourself”
UC400eth, UC300eth, UCCNC v1.2046, Neuron Lite.
UCCNC Macro Manual
Robertspark
 
Posts: 617
Joined: Sat Sep 03, 2016 4:27 pm
Location: Nr Liverpool, England

Re: safe break out of a while loop

Postby Dan911 » Sun Nov 05, 2017 9:46 pm

while (bool == true)
Dan911
 
Posts: 218
Joined: Mon Oct 31, 2016 1:22 am
Location: USA


Return to Macros

Who is online

Users browsing this forum: No registered users and 3 guests