diff options
author | Alexei Sholik <alcosholik@gmail.com> | 2013-07-05 22:18:54 +0300 |
---|---|---|
committer | Alexei Sholik <alcosholik@gmail.com> | 2013-07-05 22:18:54 +0300 |
commit | 9e4eb846c16300ef9d7466c7134387e0a8cff508 (patch) | |
tree | b59be409409027b8d57d189ed0ff06397c39c315 | |
parent | 2fd1664c296cf45a5a5640def9c8dc927e885138 (diff) |
Ruby: nil != false
Instead of saying `nil == false` (which is incorrect), show that negating `nil` and `false` produces `true`. Negating anything else will produce `false`.
-rw-r--r-- | ruby.html.markdown | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/ruby.html.markdown b/ruby.html.markdown index 2c9a4cb9..531971e9 100644 --- a/ruby.html.markdown +++ b/ruby.html.markdown @@ -43,17 +43,18 @@ false.class #=> FalseClass 1 == 1 #=> true 2 == 1 #=> false -# apart from false itself, nil is the only other 'falsey' value - -nil == false #=> true -0 == false #=> false - # Inequality 1 != 1 #=> false 2 != 1 #=> true !true #=> false !false #=> true +# apart from false itself, nil is the only other 'falsey' value + +!nil #=> true +!false #=> true +!0 #=> false + # More comparisons 1 < 10 #=> true 1 > 10 #=> false |