| rdfs:comment
| - A logical operator manipulates boolean values (values that can be truth or falsehood). Since NWScript does not have a boolean data type, the values are actually integers, interpreted as boolean values (zero is considered falsehood, while non-zero is considered truth), with the special constants TRUE and FALSE representing canonical values for truth and falsehood. The logical operators in NWScript are &&, ||, and !. These are most often seen in conditionals but are also used when assigning or returning a (logically) boolean value.
|
| abstract
| - A logical operator manipulates boolean values (values that can be truth or falsehood). Since NWScript does not have a boolean data type, the values are actually integers, interpreted as boolean values (zero is considered falsehood, while non-zero is considered truth), with the special constants TRUE and FALSE representing canonical values for truth and falsehood. The logical operators in NWScript are &&, ||, and !. These are most often seen in conditionals but are also used when assigning or returning a (logically) boolean value. The logical-and operator (&&) compares the values of two integers and produces TRUE if neither is zero, FALSE otherwise. That is, this operator produces a true value if the expression on its left and the one on its right are true. The logical-or operator (||) compares the values of two integers and produces FALSE if neither is non-zero, TRUE otherwise. That is, this operator produces a true value if the expression on its left or the one on its right is true. The logical-not operator (!) toggles the interpretation of a single integer, turning truth to FALSE and falsehood to TRUE. That is, this operator produces a boolean value that is not the boolean value of the expression on its right. The doubled character in the "and" and "or" operators is important, as the single-character version is a bitwise operator. If a bitwise operator is used in place of a logical-and or logical-or, then scripts tend to function as intended only when the just the values TRUE and FALSE are involved. Even in that case, using a bitwise operator makes the script less robust, as someone might change it later, introducing the possibility of a value other than TRUE or FALSE being involved.
|