I don't understand the SWITCH command?

Jyrki Kanerva jyrki.kanerva at mediakeel.com
Tue Jan 13 10:00:35 EST 2004


Hi,

you should add a "break" after each "case". 

on mouseup
  put word 2 of the selectedline of me into nbcalc
  
switch nbcalc
  case 1
    put 0 into fld "nbcalc"
    break
  case 2
    put 2 into fld "nbcalc"
    break
  end switch
end mouseup

Hope that helps, 

Jyrki

jyrki.kanerva at mediakeel.com

----------------------------------------
 Mediakeel Oy
 Linnanrakentajantie 6-8 C
 00880 Helsinki
 (09) 323 3121
 info at mediakeel.com
 www.mediakeel.com
 ---------------------------------------

 
>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?


Amicalement
François




More information about the use-livecode mailing list