Trouble with rust code

Hey, I am new to Rust.
Can someone help me with my code? I am using rust playground.

use std::io;

fn main(){
    let mut enter = String::new();
    
    println!("What's your name:");
    
    match io::stdin().read_line(&mut enter){
        Ok(_)=>{
            println!("Wonderful name, you have there {},", enter.to_uppercase());
        },
        Err(e) => println!("Sorry, {}", e)
    }
}

What is your question?

  1. Please format your code with backticks,
    ```
    like this
    ```
  1. If you have a code on playground, please add the link to it (Share button at the top-right).
  2. What doesn't work with this code?

The code is fine,the issue is that programs ran in the playground are not interactive (they don't get input from stdin).

what is stdin? I watched a youtube tutorial and I don't understand.

It's how a terminal passes user input to the program.

Thank you.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.