block
Structured block with optional result type.
core0x02
Syntax
block
Stack Effect
entry stack -> exit stackOpcode
- Hex
0x02- Decimal
2- Bytes
[0x02]- Encoding
0x02 <blocktype:block-type>- Immediates
blocktype:block-type— empty | valtype | typeidx (encoded via signed LEB128)
- Category
- control
Browser Support
Core WebAssembly instruction.
Validation Rules
- Operands and result types must match the instruction signature.
- The instruction must appear in a valid structured control context.
Common Mistakes
- Using the instruction with the wrong operand type.
- Forgetting that WAT validation is stack-typed.
(func $example
;; block example
)