Solidity REPL
Syntax & control flow

Recursive internal call

Call the current function internally until it reaches a base case.

Solidity 0.8.36REPL mode

Why use this example

Use this pattern to isolate Solidity branching, looping, assignment, and function-call syntax before combining it with contract state. The entry isolates recursive internal call so its input, result, and state changes stay easy to compare.

Solidity to run

function factorial(uint256 value) public pure returns (uint256) {
  if (value <= 1) return 1;
  return value * factorial(value - 1);
}

factorial(5)

Official Solidity reference

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

Internal function calls

What to expect

The internal calls descend to the base case and multiply back up to return 120.

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 writing Solidity Prototype Solidity behavior