Re: I don't understand the SWITCH command Š

Trevor DeVore lists at mangomultimedia.com
Tue Jan 13 10:38:14 EST 2004


On Jan 13, 2004, at 5:59 AM, François Cuneo wrote:

> Hello everybody!
> I have a problem with the "Switch" command.
> Here is my little Code:
>
> on mouseup
>   put word 2 of the selectedline of me into nbcalc
>
>   switch nbcalc
>
>   case 1
>     put 0 into fld "nbcalc"
>
>   case 2
>
>     put 2 into fld "nbcalc"
>   end switch
>
> end mouseup
>
> It's always the case 2 that's done, even if the nbcalc is 1!
> What's wrong please?

You need to add 'break' after each case statement.

  switch nbcalc

   case 1
     put 0 into fld "nbcalc"
     break
   case 2
     put 2 into fld "nbcalc"
     break
   end switch



-- 
Trevor DeVore
Blue Mango Multimedia
trevor at mangomultimedia.com


More information about the use-livecode mailing list