Helper function
Declare a function beside loose statements and call it directly.
Solidity 0.8.36REPL mode
Why use this example
Use this pattern to test contract composition, external calls, events, and return values inside one reproducible run. The entry isolates helper function so its input, result, and state changes stay easy to compare.
Solidity to run
function square(uint256 x) public pure returns (uint256) {
return x * x
}
square(7)What to expect
The loose call to square(7) invokes the declared helper and returns 49.
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 calls and logs Reproducible investigation