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_
That is correct.
1.9.3p0 :005 > (1...10).to_a => [1, 2, 3, 4, 5, 6, 7, 8, 9] 1.9.3p0 :006 > (1..10).to_a => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
The triple-dot syntax is less common, but is nicer than (1..10-1).to_a
(1..10-1).to_a