Get Started
- CodeAnt AI
- Control Center
- Pull Request Review
- IDE
- Compliance
- Anti-Patterns
- Code Governance
- Infrastructure Security Database
- Application Security Database
- Apex
- Bash
- C
- Clojure
- Cpp
- Csharp
- Dockerfile
- Elixir
- Lang
- Best practice
- Correctness
- Correctness
- And-truthiness
- Not-truthiness
- Or-truthiness
- Security
- Phoenix
- Fingerprints
- Generic
- Go
- Html
- Java
- Javascript
- Json
- Kotlin
- Ocaml
- Php
- Problem-based-packs
- Python
- Ruby
- Rust
- Scala
- Solidity
- Swift
- Terraform
- Typescript
- Yaml
Not-truthiness
Not truthiness
Elixir provides the concept of truthiness: nil and false are considered “falsy” and all other values are “truthy”. Many constructs in the language, such as &&/2
, ||/2
, and !/1
handle truthy and falsy values. Using those operators is not an anti-pattern. However, using those operators when all operands are expected to be booleans, may be an anti-pattern and could lead to undefined behavior.