With Ranges in Ruby you can do 0..5
to include all numbers between and including 0 and 5. You can also do 0...5
to include the same numbers except 5 is not included.
(1..5) === 5
=> true
(1...5) === 5
=> false
(1...5) === 4.999999
=> true
是否有办法排除第一个数字,而不是最后的数字来取得这样的结果?
(1...5) === 1
=> false
(1...5) === 1.00000001
=> true