From 9e4eb846c16300ef9d7466c7134387e0a8cff508 Mon Sep 17 00:00:00 2001 From: Alexei Sholik Date: Fri, 5 Jul 2013 22:18:54 +0300 Subject: 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`. --- ruby.html.markdown | 11 ++++++----- 1 file 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 -- cgit v1.2.3