Best Practices in Rev development
devin_asay at byu.edu
Thu Jun 21 13:31:29 CDT 2007
> On Jun 21, 2007, at 11:02 AM, Stephen Barncard wrote:
>> for me a great advantage of SWITCH is the opportunity for fast and
>> easy multiple if statements done this way instead:
>> SWITCH pKey
>> CASE "B"
>> CASE return
>> CASE "P"
>> END SWITCH
>> easy to read, easy to write.
On Jun 21, 2007, at 12:07 PM, Joe Lewis Wilkins wrote:
> I agree, much cleaner and easier to follow and write, so long as
> you don't forget to exit each of the case statements so as not to
> have subsequent ones executed as well. I believe this is a feature
> in Rev, though I'd prefer if it weren't.
Until this week I might have agreed with you--the concept that a case
statement would automatically match subsequent cases unless you
explicitly add a 'break' command seemed bothersome and obscure. But
then I began making some changes to a scheduling program I am working
on. I wanted to do one thing if the scheduled event fell in the 1st
or 2nd week of the month and something else if it fell in the 3rd or
4th week and something else still if it fell in the 5th week.
I could have said
Instead, I was able to use the very quick and readable:
It was the first time I'd found this feature useful, and now I'm
really glad it's there. Suddently the 'break' statements don't seem
Humanities Technology and Research Support Center
Brigham Young University
More information about the use-livecode