Problem with a switch control structure

Klaus Major klaus at major-k.de
Sat Mar 18 07:13:17 EST 2006


Bonjour Girard,

> Hi all,
>
> I have got this script, and I have got a problem.
>
> put "1" into toto
> switch toto
>  case toto > 1
>  answer ">1"
>  break
> case toto < 1
>  answer "<1"
>  break
> case toto = 1
>  answer "=1"
>  break
> end switch
>
> The problem is that none of these case is executed. Problably I  
> have forget something, but I don't know what.

this will work:

put "1" into toto
switch
## without toto, since in this case we have an EXPRESSION
## and not a VALUE that has to be evaluated...
  case toto > 1
  answer ">1"
  break
case toto < 1
  answer "<1"
  break
case toto = 1
  answer "=1"
  break
end switch

Check the docs for a deeper explanation of "why" :-)

> Regards,
>
> Girard Damien

Regards

Klaus Major
klaus at major-k.de
http://www.major-k.de




More information about the Use-livecode mailing list