Control Flow
As we have seen, if
is an expression in Rust. It is used to conditionally evaluate one of two blocks, but the blocks can have a value which then becomes the value of the if
expression. Other control flow expressions work similarly in Rust.