How to infer the return type of a function?

Viewed 7775

The return type of a block is inferred.

fn main() {
    let x = { 5 };
    println!("{}", x);
}

But when I give the block a name, I have to specify a type.

fn five() -> i32 {
    5
}

fn main() {
    let x = five();
    println!("{}", x);
}

How can I avoid selecting a type?

1 Answers
Related