A Rust range marks a span from a starting value to an endpoint. The `..` form excludes its endpoint; `..=` includes it. For example, `2..5` contains 2, 3, and 4. section 3.1.1 section 3.2.3
fn main() {
let array_of_ten = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
let two_to_five = &array_of_ten[2..5]; #1
let start_at_one = &array_of_ten[1..]; #2
let end_at_five = &array_of_ten[..5]; #3
let everything = &array_of_ten[..]; #4
println!("Two to five: {two_to_five:?},
Start at one: {start_at_one:?},
End at five: {end_at_five:?},
Everything: {everything:?}");
}
These ranges select parts of an array: `2..5` selects indexes 2, 3, and 4, while omitting a boundary selects from the start or through the end. section 3.1.1
Ranges also provide values for `for` loops. Use `0..3` to loop over 0, 1, and 2, or `0..=3` to include 3. section 3.2.3






