literal intervals

Literal intervals

An interval is the return value of methods .. and ..< of the types Byte, Short, Int, Char, and Boolean. Then, if first and last are integers, first..last returns an interval with all integers numbers between first and last, including this last one. Operator ..< does not include the last element.

var Interval<Int> inter;

inter = 3..5;

assert inter asArray == [ 3, 4, 5 ];

assert 5050 == 1..100 asArray sum;

Operator “..” has smaller precedence than the arithmetical operators and greater precedence than the logical and comparison operators.