Control structure with "not"

dunbarx at aol.com dunbarx at aol.com
Tue Aug 4 17:47:09 EDT 2015


Hi.


Your if-then would be better served as:



on doThisThing tSender
	if tSender is not “Apple” then set tSwitchApple to true
	else if Sender is not “Peach” then set tSwitchPeach to true
	else if Sender is not “Grape” then set tSwitchGrape to true
end doThisThing


The switch is as follows, but note that you cannot "set" a variable, only a property. So though the overall syntax that follows is correct, the handler will not compile.



on doThisThing tSender
   switch
      case tSender is not “Apple”
         set tSwitchApple to true
         break
      case tSender is not “Peach”
         set tSwitchApple to true
         break
      case tSender is not “Grape”
         set tSwitchApple to true
         break
   end switch
end doThisThing



In other words, the snippet "set tSwitchApple to true" has to be something like:


set the tSwitchApple of this stack to "true"


or if indeed a variable"


put "true" into tSwitchApple


Craig Newman












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





-----Original Message-----
From: Peter Bogdanoff <bogdanoff at me.com>
To: How to use LiveCode <use-livecode at lists.runrev.com>
Sent: Tue, Aug 4, 2015 5:26 pm
Subject: Control structure with "not"


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 at lists.runrev.com
Please visit this url to subscribe,
unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

 




More information about the use-livecode mailing list