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 returning multiple values

fn stats(a: f32, b: f32) -> (f32, f32) {
    (a + b, a * b)
}
fn main() {
    let (sum, multiple) = stats(4.0, 7.0);
    println!("{sum}, {multiple}");
}
11, 28