Rust Program to Read a String From the User

You may have come across many doubts and confusions in the article. We guarantee that all your queries will be resolved via the Rust Program to Read a String From the User article.

Rust Program to Read a String From the User

Rust Program to Read a String From the User

// Rust program to read a string 
// from the user

fn main(){
   let mut Str = String::new();
   
   println!("Enter String: ");
   std::io::stdin().read_line(&mut Str);
   
   println!("String is: {}", Str);
}
Enter String: 
Hello World
String is: Hello World

Final Words

We hope the Rust Program to Read a String From the User article clears up your doubts and confusion. See you again in a good article. Thanks.

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