Switch, Case and wild-cards?

Richmond richmondmathewson at gmail.com
Thu Dec 27 17:26:07 EST 2012


So there I am up to my thighs in a switch statement with a good 500 odd 
cases . . .

. . . and, like treacle, I find myself getting bogged down . . .

e.g:

    switch the text of fld "TEKST"
       case 1
         --do something--
       break
       case 2
         --do something else--
       break
    end switch

is all very charming and straightforward.

But, suppose I would like to include a CASE for ALL excluded cases (hope 
you are following me here):

e.g:

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

Richmond.




More information about the use-livecode mailing list