Creates a bounded sequence of exactly representable integer Numbers from start inclusive to end exclusive.
Signature
func range(end: Number) -> Res[List[Number], DataError]
func range(start: Number, end: Number) -> Res[List[Number], DataError]Each bound must be finite, integral, and exactly representable from -9007199254740991 through 9007199254740991. End is exclusive; descending bounds produce an empty list. Invalid endpoints return DataError; a host resource limit remains a Diagnostic.
Parameters
Returns
Examples
Range from zero
One bound starts at zero.
main.kj
Loading…Drag to orbit · select to inspect
0 entities
Scene controls
Results
Loading the language runtime…
Output 0
No output.
State
Compile source to inspect its values.
TraceNo execution yet
- Executed source spans appear here.
Expected output
3
Range with bounds
The start is inclusive and end is exclusive.
main.kj
Loading…Drag to orbit · select to inspect
0 entities
Scene controls
Results
Loading the language runtime…
Output 0
No output.
State
Compile source to inspect its values.
TraceNo execution yet
- Executed source spans appear here.
Expected output
3
Rust definition
Rust interpreter builtin dispatch; one- and two-argument Number overloads return Res[List[Number], DataError] for invalid numeric endpoints.
View Rust documentation →Support: runtime