Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Compare integers in and if-statement

fn main() {
    let answer = 42;

    if answer > 0 {
        println!("answer = {answer} is greater than 0")
    } else {
        println!("answer = {answer} is less than than 0")
    }
}