Skip to content

Latest commit

 

History

History
22 lines (16 loc) · 432 Bytes

if.md

File metadata and controls

22 lines (16 loc) · 432 Bytes

% if

There is a new edition of the book and this is an old link.

An if expression allows us to branch our code depending on conditions.

fn main() {
    let number = 3;

    if number < 5 {
        println!("condition was true");
    } else {
        println!("condition was false");
    }
}

You can find the latest version of this information here.