for loop

202307072008
Status: #idea
Tags: Rust

for loop

let a = [10, 20, 30];

for x in a {
	println!("Current element is: {x}");
}
for t in (1..4).rev() { // Range object [start, end)
	println!("{t}!");
}
println!("LIFTOFF!!!")

References

  1. https://rust-book.cs.brown.edu/ch03-05-control-flow.html#looping-through-a-collection-with-for
  2. Control Flow