Switch or If

Richard Gaskin ambassador at fourthworld.com
Thu Apr 23 12:47:31 EDT 2009

Phil Davis wrote:
> Unless you're building something where the small difference in speed is 
> absolutely critical, I would seek to answer a different question:  Which 
> structure will be easier to understand and maintain in the future when I 
> (or others) come back to it?

Wise words.  While I often adhere to the motto "A clock cycle saved 
today is a clock cycle that can be put toward more powerful features 
tomorrow", we need to balance that with time-to-market and robustness.

In many cases it should be possible to make whatever evaluation needs to 
be done with either "case" or "if" outside of repeat loops, so you can 
use whichever form best represents the logic involved while optimizing 
performance even more than using either within the loop.

  Richard Gaskin
  Fourth World
  Revolution training and consulting: http://www.fourthworld.com
  Webzine for Rev developers: http://www.revjournal.com

More information about the use-livecode mailing list