Comparisons : Equals, Greater Than, Less Than

These nodes compare their child nodes, and if the condition is met, the changedTrue event fires. For instance, if we want an event to occur after exactly 5 button clicks, we can use a conditional to see if the counter is equal to 5.

equalTo


equalTo (when(changedTrue,
	print("ok, 5 clicks is enough!  you can stop now.")))
{
	value counter()
	value (value(5))
}

wandTrigger(when(button1,counter.increment))

equalTo will always compare its two children: counter, and the other anonymous value node. When using equalTo, you always should give it at least two children for it to compare. If you're comparing one changing value against a static value, as in this example, just create another value node and set its value to the amount you're comparing against.

greaterThan


greaterThan (when(changedTrue,
	print("you've pressed the button more than 5 times!  that's too many!")))
{
	value counter()
	value (value(5))
}

wandTrigger(when(button1,counter.increment))


(c) Ben Chang