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

Ternary operator

Rust

#![allow(unused)]
fn main() {
let a = 5;
let x = if a > 10 { 20 } else { 30 };
}

Python

a = 5
x = 12 if a > 10 else 30;