local.tee
Pops a value off the stack and sets a variable's value with it, and pushes the value back onto the stack.
This functions just like the local.set
instruction but it keeps the value on the stack.
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
* |
The same value that was stored on the stack before the instruction. |
Example
(func $example
(local $age i32)
i32.const 42
local.tee $age
)