Skip to content

Commit

Permalink
Added "and" and "or" to the early part of the ink doc
Browse files Browse the repository at this point in the history
  • Loading branch information
joningold committed Jun 5, 2019
1 parent 6aa51a0 commit eb565f6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Documentation/WritingWithInk.md
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,15 @@ You can use several logical tests on an option; if you do, *all* the tests must
+ { visit_paris } { not bored_of_paris }
[Return to Paris] -> visit_paris

#### Logical operators: AND and OR

The above "multiple conditions" are really just conditions with an the usual programming AND operator. Ink supports `and` (also written as `&&`) and `or` (also written as `||`) in the usual way, as well as brackets.

* { not (visit_paris or visit_rome) && (visit_london || visit_new_york) } [ Wait. Go where? I'm confused. ] -> visit_someplace

For non-programmers `X and Y` means both X and Y must be true. `X or Y` means either or both. We don't have a `xor`.

You can also use the standard `!` for `not`, though it'll sometimes confuse the compiler which thinks `{!text}` is a once-only list. We recommend using `not` because negated boolean tests are never that exciting.

#### Advanced: knot/stitch labels are actually read counts

Expand All @@ -555,6 +563,7 @@ If it's non-zero, it'll return true in a test like the one above, but you can al

* {seen_clue > 3} [Flat-out arrest Mr Jefferson]


#### Advanced: more logic

**ink** supports a lot more logic and conditionality than covered here - see the section on 'variables and logic'.
Expand Down

0 comments on commit eb565f6

Please sign in to comment.