This version is out of date, covering development from v4.6.0 to v4.7.1. It is maintained here only for inbound reference links from elsewhere. Jump to the current version of aTbRef. |
|
A Tinderbox Reference File : Actions & Rules : Operators : Action Operator Scope : Item-based operators : |= (logical OR) | aTbRef Site Map |
|= (logical OR) |
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: Item-based operators | |
Previous: word(data) | Next: exportedString(data,template) |
Licensed under Creative Commons Attribution-Noncommercial-Share Alike 3.0 License
[See aTbRef CC licence Attribution/Waiver info info]