book icon indicating copy to clipboard operation
book copied to clipboard

doc: added another solution to ch03-03: functions

Open dotdc opened this issue 3 years ago • 0 comments

Just added another way to fix the last code sample from https://doc.rust-lang.org/book/ch03-03-how-functions-work.html

fn main() {
    let x = plus_one(5);

    println!("The value of x is: {x}");
}

fn plus_one(x: i32) -> i32 {
    x + 1;
}

dotdc avatar Oct 29 '22 22:10 dotdc