SplitScript reference / Language / range
range
syntax
start..<end | start..=end | T..<T | T..=T
Creates an explicitly exclusive or inclusive integer range.
..< excludes the upper endpoint and ..= includes it. The operator is mandatory: bare .. is rejected so endpoint inclusion never depends on remembered language convention. Both endpoints have one exact Integer type, and the corresponding first-class type repeats that bound around the same operator. A reversed ascending range is empty. Direct for iteration does not allocate a range object; storing or passing the range preserves it as an immutable value.
Examples
Exclude the upper endpoint
for index in 0u32..<3 {
print(index)
}
Pass an inclusive range as a value
fn visit(checkpoints: u8..=u8) {
for checkpoint in checkpoints {
print(checkpoint)
}
}
visit(1u8..=3)