Skip to content

Commit

Permalink
add negating conditions page
Browse files Browse the repository at this point in the history
  • Loading branch information
x87 committed Aug 11, 2024
1 parent b388f3b commit f19d1f5
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion content/negating-conditions.md
Original file line number Diff line number Diff line change
@@ -1 +1,35 @@
TBD
To invert the condition and produce a truthy result when the conditions is not met, use the `not` operator. This operator negates the condition that follows it.

```sb
if
not is_player_playing 0
then
// execute this code if the player is not playing
end
```

`not` can be used with math expressions as well:

```sb
if not x > 5 // if x is not greater than 5
then
//
end
```

Some operators have a negated version, i.e. an operator that does the opposite. For example, `==` is the equality operator, and `<>` is the inequality operator. The following two conditions are equivalent:

```sb
not x == 5
x <> 5
```

Here is a list of negated operators:

| Operator | Negated operator |
| -------- | ---------------- |
| `==` | `<>` |
| `>` | `<=` |
| `<` | `>=` |
| `>=` | `<` |
| `<=` | `>` |

0 comments on commit f19d1f5

Please sign in to comment.