File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed
Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -634,20 +634,25 @@ Never use `::` for regular method invocation.
634634 x = !something
635635 ```
636636
637- * Avoid the use of `!!` to convert an object to a `boolean` value .
637+ * Avoid the use of `!!`.
638638
639639 ```Ruby
640- # bad - doesn ' t work properly with boolean values
640+ # bad
641641 x = ' test '
642- ! !x # => true
642+ # obscure nil check
643+ if !!x
644+ # body omitted
645+ end
646+
643647 x = false
648+ # double negation is useless on booleans
644649 !!x # => false
645650
646- # good - works for all values (+ it's more readable)
651+ # good
647652 x = ' test '
648- ! x.nil? # => true
649- x = false
650- ! x.nil? # => true
653+ if !x.nil?
654+ # body omitted
655+ end
651656 ```
652657
653658* The `and` and `or` keywords are banned. It' s just not worth
You can’t perform that action at this time.
0 commit comments