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

Conditional: if - else

  • if
  • else
fn main() {
    let x = 23;
    let y = 32;
    if x > y {
        println!("x is bigger than y");
    } else {
        println!("x is smaller than y or equal to it");
    }
}
x is smaller than y or equal to it