> For the complete documentation index, see [llms.txt](https://muradkarakas.gitbook.io/sodium_documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://muradkarakas.gitbook.io/sodium_documentation/language-reference/lexical-elements/expressions-and-operators/logical-operators.md).

# Logical Operators

Logical operators test the truth value of a pair of operands.

* The logical conjunction operator `and` tests if two expressions are both true. Even thought the first expression is false, the second expression will be evaluated.

```
if ((x == 5) and (y == 10)) then
    message("x is 5 and y is 10");
end if;
```

* The logical disjunction operator `or` tests if at least one of two expressions it true. Even thought the first expression is true, the second expression will be evaluated.

```
if ((x == 5) or (y == 10)) then
   message("x is 5 or y is 10");
end if;
```

* You can prepend a logical expression with a negation operator `!` to flip the truth value. The logical expression must be between parenthesis.

```
if (!(x == 5)) then
    message("x is not 5");
end if;
```
