The select instruction, selects one of its first two operands based on whether its third operand is zero or not. It shares some similarities with the ternary operator in other languages (e.g. false ? 10 : 20), but doesn't short-circuit.

Try it


;; push two values onto the stack
i32.const 10
i32.const 20

;; change to `1` (true) to get the first value (`10`)
i32.const 0
Instruction Binary opcode
select 0x1b
select t 0x1c