--

In fact the main difference in Rust is if (and match in your exemple) are expression , not statement. That mean he return something (depending your code).

Then can write

let result = if a > 5
{ « above five »}
else { « bellow five »}

Then you will find a string in ‘result’ .

This small difference is one of the superpower of Rust.

--

--

Responses (1)