Rust's solution to this is quite good, that's 0..9 and if you want to include 9 it's 0..=9, it looks a bit funny but knowing one with an = sign in it exists removes any doubt
Edit: it doesn't use Range for ..=, but rather RangeInclusive, which works fine.
for i in 0..length {
…
}
for i in 0..=maxindex {
…
}