Header logo.
small hallucinations
homeyearstagsaboutrss

Something clever in the syntax of Elixir

I find this aspect of Elixir's syntax quite clever.

There are two sets of Boolean operators in Elixir: and, or, and not, and &&, ||, and !.

The difference is that and, or, and not accept only literal Boolean values. In contrast, &&, ||, and ! can accept values of any type, and all values except false and nil evaluate to true.

When you think about it, this makes a lot of sense. Literal Boolean values—true and false—are words, so it's only natural that they go with the words and, or, and not.