Skip to content

Commit ad97f93

Browse files
authored
Add a rule of thumb (#13813)
A rule of thumb when to prefer using `and`, `or` and `not` over `&&`, `||` and `!`
1 parent 37e5539 commit ad97f93

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/elixir/pages/getting-started/basic-types.md

+2
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ true
169169

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

172+
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 `!`.
173+
172174
## Atoms
173175

174176
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:

0 commit comments

Comments
 (0)