Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Return a string

  • String
fn main() {
    let name = get_name();
    println!("{}", name);
}

fn get_name() -> String {
    let fname = "Foo";
    let lname = "Bar";
    let name = format!("{} {}", fname, lname);
    println!("{}", name);
    name
}