DEV Community

Discussion on: Which types of loops are most popular in the programming languages you use?

Collapse
 
quantumsheep profile image
Nathanael Demacon

In Rust it's quite a simple syntax:

for i in 1..100 {
    println!("{}", i);
}

And for Vec:

let mut nums: Vec<i32> = Vec::new();
nums.push(1);
nums.push(2);
nums.push(3);

for i in nums {
    println!("{}", i);
}

Same syntax for everything \o/