Exit Switch or break switch question

len-morgan at crcom.net len-morgan at crcom.net
Thu Mar 20 11:31:14 CDT 2008


If I'm not mistaken (and I frequently am), isn't there an option on
comboboxes to allow multi-line selections?  Or is that just the option
menu?

len morgan

> Hi Len,
>
> Multiple exit points seems like a good point for clarity unless maybe
> the switch is very very long then you would know if one was found it
> would be the absolute end of the script instead of the possibility of
> it finding another match as well later on in the script.
>
> However, with that said, this is a combo box and I would think only
> one choice can match so the break seems to be my answer for both
> clarity (smaller script) and few keystrokes and because no other
> matches are possible anyway.
>
> Thanks,
>
> Tom McGrath
>
>
> On Mar 20, 2008, at 11:11 AM, len-morgan at crcom.net wrote:
>
>> I've always used the second example you had.  Sometimes it can get a
>> little harder to debug (and less clear for someone else reading your
>> code)
>> if you have multiple exit points.  In the end, I think they both
>> accomplish the same thing.
>>
>> len morgan
>>
>>> If I want to leave a switch statement after successfully matching a
>>> case is it better to break and rund to the end without a default
>>> statement or to exit the switch from that case?
>>>
>>> ComboBox
>>>
>>> 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
>>>
>>> Thank you,
>>>
>>> Tom McGrath
>>> _______________________________________________
>>> 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
>>>
>>
>>
>> _______________________________________________
>> 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
>
> _______________________________________________
> 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