Answer the question
In order to leave comments, you need to log in
Why write fn main() -> io::Result{ in Rust like this?
use std::io;
fn main() -> io::Result<()>{
let mut input = String::new();
println!("Введите свое имя: ");
io::stdin().read_line(&mut input)?;
println!("Ваш имя: {}", input);
Ok(())
}
Answer the question
In order to leave comments, you need to log in
It is not used anywhere in this code.
use std::io;
fn main() -> io::Result<()>{
let mut input = String::new();
println!("Введите свое имя: ");
io::stdin().read_line(&mut input)?; // Тут
println!("Ваш имя: {}", input);
Ok(()) // И тут
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question