Curriculum Basics Conditionals (if and switch) exercise 1 · mcq
Conditionals (if and switch)
TypeScript writes if (cond) { ... } with parens around the
condition. Zig keeps the parens — a pleasant surprise after Go,
which drops them. Pick the Zig translation of this TS condition.
TypeScript reference
About this theme
Zig's if looks like TypeScript's: parens around the condition, optional braces around the body. The catch: Zig has no truthy values — the condition must be bool. switch is an expression in Zig (not a statement), so it can be assigned directly. The TS reflex matches Zig here more cleanly than it matches Go.