Basics
Loops
Use for for range loops, conditional loops, or unconditional loops.
fn main() -> i32 {
let mut total = 0;
for n in 1..=6 {
total = total + n;
}
return total + total;
}terminal
hopper run demo src
.. excludes the final bound and ..= includes it. break exits the nearest loop and continue starts its next iteration. The range form shown here uses integers.