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

{{WebAssemblySidebar}}

The block statement creates a label that can later be branched out of with a br.

The loop statement is the opposite of the block statement, in the sense that while branching to a loop jumps to the beginning of the loop, branching to a block jumps to the end of the block; that is, out of the block.

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

Syntax

;; label the block so that it can be branched to. (block $my_block ;; branch to the block. ;; most of the time you'll want to put this in an if statement and only branch on condition, ;; otherwise the following control flow are unreachable. br $my_block ;; this will never be reached, since the br jumped out of the block already. unreachable )
InstructionBinary opcode
block0x02