Dec 19, 2023
Tutorials
ZxStim
Immutable variables are like constants. Values of immutable variables can be set inside the constructor but cannot be modified afterwards.
Compile and deploy the code block below:
solidityImmutable.sol// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; contract Immutable { // coding convention to uppercase constant variables address public immutable MY_ADDRESS; uint public immutable MY_UINT; constructor(uint _myUint) { MY_ADDRESS = msg.sender; MY_UINT = _myUint; } }