Header logo.
A study of bugs
HomeArchiveTagsAboutFeed

Something clever in the syntax of Elixir

I find this quite clever in the syntax of Elixir.

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

The difference is that and, or, not only take literal boolean values. In contrast, &&, ||, ! can take values of all types. And all values except false and nil will evaluate to true.

When you think about it, it makes a lot of sense. Because literal boolean values -- true and false -- are words. It's only natural that they go with words: and, or, not.