local.set
Pops a value off the stack and sets a variable's value with it.

Syntax

local.set $label

Parameters

$label
The label name of the local variable. This can also be the index of the local variable. The variable will be set to the value on the stack. The value on the stack must be the same data type as the variable.

Stack In

* The value to be stored in the local variable. The data type must be the same as the variable used.

Stack Out

NONE

Example

;; Example function
(func $example
    ;; Create local variable
    (local $age i32)
    
    ;; Set $age local variable
    i32.const 42
    local.set $age
    ...
)