Back to glossary

Assembly Variable (Solidity Code Example)

Table of Contents

Example of how to declare variables inside assembly.

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;

contract AssemblyVariable {
    function yul_let() public pure returns (uint256 z) {
        assembly {
            // Language used for assembly is called Yul
            // Local variables
            let x := 123
            z := 456
        }
    }
}

Related Terms

No items found.