Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
mohamedkhallouq
GitHub Repository: mohamedkhallouq/content
Path: blob/main/files/en-us/webassembly/reference/control_flow/if...else/index.md
6510 views
---
title: if...else slug: WebAssembly/Reference/Control_flow/if...else
---

{{WebAssemblySidebar}}

The if statement executes a statement if the last item on the stack is true (1). If the condition is false (0), another statement can be executed

{{EmbedInteractiveExample("pages/wat/if...else.html", "tabbed-taller")}}

Syntax

i32.const 0 (if (then ;; do something ) (else ;; do something else ) )
InstructionBinary opcode
if0x04
else0x05