Integer ranges
start..end creates a half-open integer range that includes start and stops before end. A descending range walks downward. A range has start and end fields.
Inclusive ..= belongs in patterns, where it matches both bounds. Keeping iteration half-open makes lengths and indexes compose directly.
fn main() {
for index in 0..3 {
println(index)
}
}
Examples use the moon toolchain version shown beside each result.
Output & diagnostics
Expected: 0 1 2
Ctrl/⌘+Enter runs the current lesson.