E0023Range outside
Error
Range outside for and patterns
ErrorA range such as 0..n or 0..=n can only be the source of a for loop, or a pattern in a match arm.
Why
A range is not a value in Sisu. It describes what a for loop counts through, or which values a pattern matches, so it cannot be stored, passed or returned.
Broken
fn main() {
let r = 0..3
print(1)
}
What sisu says
error[E0023]: ranges are only allowed in `for` and in patterns --> E0023.sisu:2:14 | 2 | let r = 0..3 | ^^ sisu: 1 error sisu: for more on a code, run `sisu explain <code>`: E0023
Fixed
fn main() {
for i in 0..3 {
print(i)
}
}
Sisu