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

Function in the main.rs file

  • We already know that we can define functions in the main.rs file and call them.
fn main() {
    println!("main");
    in_main();
}

fn in_main() {
    println!("in_main");
}
main
in_main