I've just started learning Ruby and Ruby on Rails and came across validation code that uses ranges:
validates_inclusion_of :age, :in => 21..99
validates_exclusion_of :age, :in => 0...21, :message => "Sorry, you must be over 21"
At first I thought the difference was in the inclusion of endpoints, but in the API docs I looked into, it didn't seem to matter whether it was ..
or ...
: it always included the endpoints.
However, I did some testing in irb and it seemed to indicate that ..
includes both endpoints, while ...
only included the lower bound but not the upper one. Is this correct?