|= (logical OR)

Tinderbox Icon

Operator Type:   Assignment
Operator Scope of Action:   Item

To make is easier to write rules succinctly, you may use the assignment:

$TheAttribute |= expression; 

... which sets TheAttribute to true if it is already true, or if the expression is true. Thus, if TheAttribute is false, the expression is not checked and the overall result is false. An attribute that has no value set (or inherited) is evaluated as false.

Happily, this means the left side only receives a value if is doesn't hold one already. This fact makes the |= usage very useful for doing things like making code run only once - on the second pass the left side already has a value so no change occurs. This avoids things like looping causing multiple concatenation of strings.

For example:

$Urgent |= any(child,$Urgent) 

A project is urgent if it's been declared to be urgent itself, or if any child is urgent.

See also the logical AND assignment.

Up: Full Operator List
Previous: word(data)   

[Last updated: 14 Dec 2009, using v5.0]

Google search aTbRef for:  

Licensed under Creative Commons Attribution-Noncommercial-Share Alike 3.0 License
[See aTbRef CC licence Attribution/Waiver info info]

Creative Commons License

Made with Tinderbox