| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/en-US/docs/WebAssembly/Reference/Control_flow/br | [Back] [Original] |
Get to know MDN better
(module
;; Import the browser console object, which you'll need to pass in from JavaScript
(import "console" "log" (func $log (param i32)))
(func
(block $my_block
;; Break out of the block
;; If this is removed, the code will throw an error when it reaches `unreachable`
br $my_block
;; The code will never reach this point since we broke out of the block
unreachable
)
)
(start 1) ;; run the first function automatically
)
const url = "{%wasm-url%}";
await WebAssembly.instantiateStreaming(fetch(url), { console });
;; label the loop so that it can be branched to
(loop $my_loop
;; branch to the loop.
;; most of the time you'll want to put this in an if statement and only branch on condition,
;; otherwise you have an infinite loop.
br $my_loop
)
| Instruction | Binary opcode |
|---|---|
br |
0x0c |
| Specification |
|---|
| WebAssembly Core Specification # -hrefsyntax-instr-controlmathsfbrl |
This page was last modified on Jul 19, 2026 by MDN contributors.
Your blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |