Rust Program to Use an Iterator to Traverse the Mutable Vector Elements

Using this tutorial you will successfully complete the task of Rust Program to Use an Iterator to Traverse the Mutable Vector Elements Let’s go

Rust Program to Use an Iterator to Traverse the Mutable Vector Elements

Rust Program to Use an Iterator to Traverse the Mutable Vector Elements

// Rust program to use of an iterator to 
// traverse the mutable vector elements

fn main() 
{
   	let mut countries = vec!["India", "UK", "USA", "Canada"];
   
   	println!("Country names: ");
   	for country in countries.iter_mut() 
   	{
		println!("  {}",country);
   	}
}
Country names: 
  India
  UK
  USA
  Canada

Final Words

We hope you find the Rust Program to Use an Iterator to Traverse the Mutable Vector Elements. What to do if there are any issues with this article? Then ask through the comment section.

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Deekshi. Here, I post about programming to help developers.

Share on:

Leave a Comment