Message function selector
Compare msg.sig inside a call with the function’s selector member.
Solidity 0.8.36REPL mode
Why use this example
Use this pattern when the answer depends on transaction fields, block data, chain identity, payable value, or live RPC state. The entry isolates message function selector so its input, result, and state changes stay easy to compare.
Solidity to run
contract SelectorProbe {
function capture(uint256) external pure returns (bytes4) {
return msg.sig;
}
}
SelectorProbe probe = new SelectorProbe()
probe.capture(42)
SelectorProbe.capture.selectorOfficial Solidity reference
Compare this focused investigation with the complete language definition in the Solidity documentation.
Special variables and functionsWhat to expect
The selector observed through msg.sig matches the capture function’s compile-time selector member.
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 execution controls Deployed contract investigation