You can always use 'switch' without specifying an expression to evaluate as part of the 'switch' line, like so:

    switch
        case (tSender is not "Apple")
            put true into tSwitchApple
            --break
        case (tSender is not "Peach")
            put true into tSwitchPeach
            --break
        case (tSender is not "Grape")
            put true into tSwitchGrape
            --break
    end switch


Or there's this. It doesn't generate errors but it also doesn't work - the variables are not filled by it:

    switch  tSender
        case (not "Apple")
            put true into tSwitchApple
            --break
        case (not "Peach")
            put true into tSwitchPeach
            --break
        case (not "Grape")
            put true into tSwitchGrape
            --break
    end switch

("break" is commented to allow same logic flow as your example)


Here's another way (that does work) to skin that cat:

on doThisThing pSender
    constant kFruits = "Apple,Peach,Grape"

    put kFruits into tFruitsA
    split tFruitsA with comma as set
    put false into tFruitsA[pSender]
end doThisThing


I love arrays.
And there are probably many other ways to do it.

Phil Davis



On 8/4/15 2:24 PM, Peter Bogdanoff wrote:
Is it possible to convert this to a switch control structure, or otherwise 
refined somehow? The “not” is what I need, and the setting has to be always 
“true”:

on doThisThing tSender
        if tSender is not “Apple” then
                set tSwitchApple to true
        end if

        if Sender is not “Peach” then
                set tSwitchPeach to true
        end if

        if Sender is not “Grape” then
                set tSwitchGrape to true
        end if
end doThisThing

Peter Bogdanoff
UCLA
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


--
Phil Davis


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to