home ~ socials ~ projects ~ rss

Rust "for" Loop Example

April 2024
fn main() {
  for i in 1..=10 {
    println!("Count: {}", i);
  }
}
Output:
Count: 1
Count: 2
Count: 3
Count: 4
Count: 5
Count: 6
Count: 7
Count: 8
Count: 9
Count: 10
end of line
Share link:
https://www.alanwsmith.com/en/2e/m2/jk/dx/?rust-for-loop-example