| Start |
|---|
| All objects may be converted to booleans in Ruby Use the double negation syntax to check for truthiness of values. All values correspond to a boolean, irrespective of their type. All values except |
| Truthiness of a value can be used in if-else constructs You do not need to use double negation in if-else statements. The above code prints 'hey!' on the screen. RemarksAs a rule of thumb, avoid using double-negations in code. Rubocop says (opens new window) that double negations are unnecessarily complex and can often be replaced with something more readable. Instead of writing use |
Read Article
https://develop.horje.com/learn/1434/reference