The binary range operator is represented by the
colon :
. It is
syntactically rightassociative (it groups righttoleft).
The range expression yields a contiguous range of integral values.
Range Expression  


Binary numeric promotion is performed on the operands. The type of the range
expression is the promoted type. It is a
compiletime error if this type is not int
or long
.
The range expression is a generator expression. Its sequential evaluation evaluates both operands and yields all values of its type between the value of the first and the value of the second operand in ascending order, including the boundary values. If the value of the first operand is greater than the value of the second operand, no value is yielded.