Getting started with Assembly programming
Assembly code can be mixed with Solidity code using the assembly
keyword, followed by brackets defining a block. There can be as many assembly blocks as needed within a Solidity function. The SimpleAssembly
contract shown in the following code block shows the usage of Solidity code intertwined with multiple assembly blocks:
// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.7.0 <0.9.0; contract SimpleAssembly { function AssemblyUsage() public pure returns (uint256) { uint256 i = 10; assembly { i := 100 } assembly { i := 200...