Skip to content
Free public beta until December 4, 2026: every course is open, no card needed. After that, the first chapter of each course stays free and full access is a one-time $39 ($19 for up to 100 founding members chosen for helpful feedback). Your progress is kept. How the beta works

conditional operator

condition ? a : b: a one-line if/else that produces a value.

The conditional operator c ? a : b evaluates c and then exactly one of a or b; it is right-associative.

Examples

  • string label = stock > 0 ? "In stock" : "Sold out";

Read the full section →