# Twine Wiki

### Special passage tags

harlowe:boolean

This is an old revision of the document!

Computers can perform more than just mathematical tasks - they are also virtuosos in classical logic. Much as how arithmetic involves manipulating number with addition, multiplication and such, logic involves manipulating the values `true` and `false` using its own operators. Those are not text string - they are values as fundamental as the natural numbers. In computer science, they are both called Booleans, after the 19th century mathematician George Boole.

`is` is a logical operator. Just as + adds the two numbers on each side of it, `is` compares two values on each side and evaluates to `true` or `false` depending on whether they're identical. It works equally well with strings, numbers, Array, and anything else, but beware - the string `"2"` is not equal to the number 2.

There are several other logical operators available.

 Operator `is` Evaluates to `true` if both sides are equal, otherwise `false`. `is not` Evaluates to `true` if both sides are not equal. `contains` Evaluates to `true` if the left side contains the right side. `is in` Evaluates to `true` if the right side contains the left side. `>` Evaluates to `true` if the left side is greater than the right side. `>=` Evaluates to `true` if the left side is greater than or equal to the right side. `<` Evaluates to `true` if the left side is less than the right side. `<=` Evaluates to `true` if the left side is less than or equal to the right side. `and` Evaluates to `true` if both sides evaluates to `true`. `or` Evaluates to `true` if either side is `true`. `not` Flips a `true` value to a `false` value, and vice versa.

Conditions can quickly become complicated. The best way to keep things straight is to use parentheses to group things.

harlowe/boolean.1497852998.txt.gz · Last modified: 2017/10/09 20:37 (external edit)