Skip to content

Commit

Permalink
Add a rule of thumb (#13813)
Browse files Browse the repository at this point in the history
A rule of thumb when to prefer using `and`, `or` and `not` over `&&`, `||` and `!`
  • Loading branch information
RudolfMan authored Sep 6, 2024
1 parent 37e5539 commit ad97f93
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/elixir/pages/getting-started/basic-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ true

Similarly, values like `0` and `""`, which some other programming languages consider to be "falsy", are also "truthy" in Elixir.

As a rule of thumb, use `and`, `or` and `not` when you are expecting booleans. If any of the arguments are non-boolean, use `&&`, `||` and `!`.

## Atoms

An atom is a constant whose value is its own name. Some other languages call these symbols. They are often useful to enumerate over distinct values, such as:
Expand Down

0 comments on commit ad97f93

Please sign in to comment.