Martin DeMello wrote:

> Oliver Dain <odain2 / nospam.mindspring.com> wrote:
>  
>> The only difference is that if the an x matches both the beginning
>> and end condition your code doesn't execute body for that x while
>> mine does:
> 
> iI was basing my code on the following:
> 
> $ irb
> irb(main):001:0> (3..3) === 3
> (3..3) === 3
> => true
> irb(main):002:0> (3...3) === 3
> (3...3) === 3
> => false
> 
> martin

The above code is, I think, interpreted completely differently that 
the "if (3==3)..(3==3)" code.  Why?  The latter is a boolean range 
while the former first creates a range object and then applied 
operator === to that.  Things like 'print if /foo/../bar/' operate 
differently than other types of ranges because they're boolean 
ranges.  For example you might think

ruby -ne 'print if /foo/.../bar/'

would print all lines starting with the one that matches /foo/ up to, 
but not including (since its a 3 dot range) the line that matches 
/bar/.  That would match the meaning of a "regular" range.  But 
that's not how it works.  Instead the above will match all lines 
between /foo/ and /bar/ _including_ the /bar/ line. 

I think this is a really confusing distinction and I would prefer if 
the boolean context range acted the same way as a regular range (e.g. 
the 3 dot form means the end point isn't included in the range, 
etc.), but that isn't how its done.