Solidity REPL
Types & storage

Memory reference aliasing

See two memory variables refer to the same array allocation.

Solidity 0.8.36REPL mode

Why use this example

Use this pattern to explore how Solidity represents typed values and how state-changing expressions affect storage. The entry isolates memory reference aliasing so its input, result, and state changes stay easy to compare.

Solidity to run

uint256[] memory first = new uint256[](2)
first[0] = 7
uint256[] memory second = first
second[0] = 42

first[0]
second[0]

Official Solidity reference

Compare this focused investigation with the complete language definition in the Solidity documentation.

Data location assignment behavior

What to expect

Changing the second memory reference also changes the first, so both array reads return 42.

Continue the investigation

Change a value, add another expression, or open Inspect after the run. Accepted entries remain available to the next entry, and the clean replay keeps the complete result reproducible.

Read about state and storage Reproducible investigation