block

block 语句创建一个标签,稍后可以使用 br 跳出该标签。

loop 语句与 block 语句相反,因为跳转到 loop 会跳转到循环的开头,而跳转到 block 会跳转到块的末尾;也就是说,跳出块。

试一试

语法

wasm
;; 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

)
指令 二进制操作码
block 0x02