Best Practices in Rev development

Joe Lewis Wilkins pepetoo at cox.net
Thu Jun 21 14:07:41 EDT 2007


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.

Joe Wilkins

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"
> printThePage
> default
> doDefaultThing
> END SWITCH
>
> easy to read, easy to write.
>
>
>>
>> I haven't timed it - but if it's read by the engine in the same  
>> manner other programming languages handle it then it would be  
>> faster as any subsequent conditions are skipped because once the  
>> case statement (switch statement) is met the compiler knows not to  
>> proceed - as opposed to if/then/else etc where the entire handler  
>> is evaluated in full.
>>
>> Scott Kane
>
> -- 
>
>
> stephen barncard
> s a n  f r a n c i s c o
> - - -  - - - - - - - - -
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list