Exit Switch or break switch question
Eric Chatonet
eric.chatonet at sosmartsoftware.com
Thu Mar 20 11:33:11 EDT 2008
Hello Tom,
Le 20 mars 08 à 16:21, Thomas McGrath III a écrit :
>
> 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?
As for me I always use break and I like switch structures flexibility
and readability compared to conditional ones.
You can write a list of cases (and I find it more clear that the use
of 'or'), put a break or not and have a 'default' case that usually I
reserve for errors handling.
In menuPick handlers switch is invaluable.
But sure, you know all that yet :-)
Best regards from Paris,
Eric Chatonet.
----------------------------------------------------------------
Plugins and tutorials for Revolution: http://www.sosmartsoftware.com/
Email: eric.chatonet at sosmartsoftware.com/
----------------------------------------------------------------
More information about the use-livecode
mailing list