Switch, Case and wild-cards?

J. Landman Gay jacque at hyperactivesw.com
Thu Dec 27 17:33:45 EST 2012


On 12/27/12 4:26 PM, Richmond wrote:
>
>     switch the text of fld "TEKST"
>        case 1
>          --do something--
>        break
>        case 2
>          --do something else--
>        break
>        case "any other value in fld "TEKST" '
>          --run around babbling about purple bananas--
>        break
>     end switch
>
> has anyone any idea how to effect this sort of situation WITHOUT using a
> bunch of nested IF . . .  THEN statements instead???

That's what the "default" statement is for:

    switch the text of fld "TEKST"
       case 1
         --do something--
       break
       case 2
         --do something else--
       break
       default -- everything else
         --run around babbling about purple bananas--
       break
    end switch

However, I don't know if it always works with purple bananas.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list