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

Interpolation

Since Rust 1.58, so for quite a ling time, we can also include the name of a variable in the curly braces. This feature is called interpolation. It usually make the expression more readable.

fn main() {
    let name = "Foo";
    println!("Hello {name}, how are you?");
}

The output:

Hello Foo, how are you?