Exit Switch or break switch question

Thomas McGrath III 3mcgrath at comcast.net
Thu Mar 20 11:21:51 EDT 2008


Hey Eric,

Thanks, I knew about the behavior of the break and was more curious if  
there was a preferred method or 'correct' method. I assume then that  
you would definitely use the break. And yeah four chars to eleven is a  
point to consider.

I was thinking that break was important because of the possibility of  
matching more than one method and in hitting the default option.
I was thinking that the exit switch ensured that we were done looking  
and to stop after the first found item. This would then skip any other  
matches.

But in a ComboBox there should/can be only one choice chosen from the  
menu button so there seems to be no need to continue after a case was  
found. But does this make the case (pun) for exit switch in a combobox?

Thanks

Tom

On Mar 20, 2008, at 11:11 AM, Eric Chatonet wrote:

> Hi Tom,
>
> Break skips the rest of the current switch structure and goes to the  
> statement following the end switch.
> Only four chars to write ;-)
>
> Le 20 mars 08 à 16:06, Thomas McGrath III a écrit :
>> on menuPick pChosen
>>    switch pChosen
>>        case "Home"
>>            -- code goes here
>>            exit switch
>>         case "Work"
>>            -- code goes here
>>            exit switch
>>    end switch
>> end menuPick
>>
>> OR
>>
>> on menuPick pChosen
>>    switch pChosen
>>        case "Home"
>>            -- code goes here
>>            break
>>        case "Work"
>>            -- code goes here
>>            break
>>    end switch
>> end menuPick
>
> Best regards from Paris,
> Eric Chatonet.
> ----------------------------------------------------------------
> Plugins and tutorials for Revolution: http://www.sosmartsoftware.com/
> Email: eric.chatonet at sosmartsoftware.com/
> ----------------------------------------------------------------
>
>
> _______________________________________________
> 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