If you are talking about recursion, that is having a function call itself, be 
aware that there is a limit to recursion. But I don’t think that is what you 
are asking. 

The repeat structure is pretty damned efficient already. For repeats of a fixed 
number where your script doesn’t need the count, use repeat for x. If the 
script needs to know what the count is, repeat with x=y to z. If you need to 
repeat until a condition is true, repeat until condition is true (or the 
converse repeat while condition is not true). 

Even slicker is the repeat for each chunk x in y as in repeat for each item 
theTeam in theNBATeams. BEWARE with this one however. you MUST NOT modify the 
contents of theNBATeams in your repeat loop! This is because Livecode “maps” 
the memory holding theNBATeams by each chunk, and altering what is in that 
memory wreaks holy havoc with your scripts. Why use it you say? Because it’s 
really efficient, perhaps the most efficient of all the repeat structures. 

For small tasks though, your users will not even be able to blink before 
100,000 simple repeats are executed. I ran a 100,000 count loop with nothing in 
the repeat loop to do and it took 1 tick. ONE TICK! The repeat loop is NOT what 
slows things down! So it’s really a matter of what suits the problem you are 
trying to solve. 

Bob


On Feb 9, 2014, at 14:15 , Nakia Brewer <nakia.bre...@westrac.com.au> wrote:

> Hi,
> 
> What is the best way to keep repeating a handler/function.
> 
> In the past I have placed a 'repeat until local variable = false' in the 
> handler to keep it repeating but I don't imagine this is the most efficient 
> way.
> Am I better off using the send option or dispatch ?
> 
> Any opinions would be appreciated.
> 
> 
> 
> 
> 
> 
> 
> COPYRIGHT / DISCLAIMER: This message and/or including attached files may 
> contain confidential proprietary or privileged information. If you are not 
> the intended recipient, you are strictly prohibited from using, reproducing, 
> disclosing or distributing the information contained in this email without 
> authorisation from WesTrac. If you have received this message in error please 
> contact WesTrac on +61 8 9377 9444. We do not accept liability in connection 
> with computer virus, data corruption, delay, interruption, unauthorised 
> access or unauthorised amendment. We reserve the right to monitor all e-mail 
> communications.
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to