Ranges - Spicery/Nutmeg GitHub Wiki
Closed Ranges
Closed ranges are written A ... B
, where A and B expressions, and return a ListLike object that include the ordered values between A and B inclusively. They can be used on numbers and characters. e.g.
1 ... 5
includes the values1
,2
,3
,4
and5
.`a` ... `z`
includes the lower-case letters betweena
andz
.
Half-Open Ranges
Half-open ranges are very similar to closed-ranges except that they exclude the final value. For example:
1 ..< 5
includes the values1
,2
,3
and4
.`0` ..< `9`
includes the digits0
through to8
.
Additional Remarks
- The range operators '...' and '..<' are borrowed from the Swift programming language.