In this tutorial, we will learn Rust Program to Use an Iterator to Traverse the Vector Elements

Rust Program to Use an Iterator to Traverse the Vector Elements
// Rust program to use of an iterator to
// traverse the vector elements
fn main()
{
let countries = vec!["India", "UK", "USA", "Canada"];
println!("Country names: ");
for country in countries.into_iter()
{
println!(" {}",country);
}
}
Country names:
India
UK
USA
Canada
Final Words
I hope this article is a Rust Program to Use an Iterator to Traverse the Vector Elements Let me know in the comments section if you have any issues.