Rust

For Over A Range in Rust

RustControl FlowRangesbeginner

0..5 excludes the end, 1..=10 includes it. Ranges are iterators, so adapters like sum work on them directly.

expected output

0 1 2 3 4 
55

Why practise typing this

Typing control flow code builds muscle memory for the symbols and indentation Rust uses most, which prose-based typing tests never cover. DevType measures your words per minute and accuracy on this snippet and tracks the individual characters you mistype, so later lessons can target them.

More Rust practice

Browse all Rust snippets →