From: Austin Ziegler Date: 2005-01-31T22:34:21+09:00 Subject: Re: nil question On Mon, 31 Jan 2005 10:45:48 +0900, William James wrote: > Austin Ziegler wrote >> you can also do: >> puts "yes" if x.between?(-5, 9) >> puts "yes" if (-5..9).include?(x) > But that's not as readable as -5 < x < 9, which is how it is written for > humans in algebra. I would disagree with you regarding readability. #between? is a very natural way of reading things -- and is also enshrined in other languages (like SQL). The advantage to the algebraic way of doing things, though, is that they can be more accurate and variable with minor variations in syntax. Truth be told, my alternatives aren't *quite* the same as what was presented, because they're both inclusive. However, I *strongly* recommend you read the chain of articles to which I pointed you, because I used much the same argument as you're using. I was convinced then, and remain convinced now, that there's not enough value in this to suggest the change. (It also can result in broken code; right now, you can do: truth = (-5 < 0) p truth # => true p truth == true # # => true If I were to do an explicit comparison of TrueClass and FalseClass against #truth (instead of the concept of everything is true except false and nil), then my code would break because of this change. So the second line would no longer be useful. -austin -- Austin Ziegler * halostatue@gmail.com * Alternate: austin@halostatue.ca