Definite Loop - For Loop
This lesson will teach about finite loop, i.e., for loop.
We'll cover the following...
What Is a for Loop?
A for loop is a definite loop, meaning, the number of iterations is defined.
Syntax
The for loop is followed by a variable that iterates over a list of values.
The general syntax is :
Example
The following example uses a for loop that prints 5 numbers.
Press + to interact
Rust 1.40.0
fn main() {//define a for loopfor i in 0..5 {println!("{}", i);}}
Explanation
for loop definition
Ask