W3cubDocs

/Crystal

Range

A Range is typically constructed with a range literal:

x..y  # an inclusive range, in mathematics: [x, y]
x...y # an exclusive range, in mathematics: [x, y)

# Example:
0..5.to_a # => [0, 1, 2, 3, 4, 5]
0...5.to_a # => [0, 1, 2, 3, 4]

An easy way to remember which one is inclusive and which one is exclusive it to think of the extra dot as if it pushes y further away, thus leaving it outside of the range.

To the extent possible under law, the persons who contributed to this workhave waived
all copyright and related or neighboring rights to this workby associating CC0 with it.
https://crystal-lang.org/docs/syntax_and_semantics/literals/range.html