Explicit type conversions
Convert between integer widths, fixed bytes, and payable addresses.
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 explicit type conversions so its input, result, and state changes stay easy to compare.
Solidity to run
uint256 wide = 0x123456
uint8 narrowed = uint8(wide)
bytes4 fixedBytes = bytes4(bytes32(wide))
address payable recipient = payable(address(0xBEEF))
narrowed
fixedBytes
recipientOfficial Solidity reference
Compare this focused investigation with the complete language definition in the Solidity documentation.
Conversions between elementary typesWhat to expect
The transcript shows the narrowed uint8, fixed bytes conversion, and payable address ending in BEEF.
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