Get in touch with us! We’re here to assist you. Please fill out the form below, and we’ll respond to your inquiry as soon as possible.

Անփոփոխելի

Անփոփոխ փոփոխականները(Immutable variables) նման են հաստատունների(constants):

Անփոփոխ փոփոխականների արժեքները կարող են սահմանվել կոնստրուկտորի ներսում, սակայն չեն կարող փոփոխվել դրանից հետո:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

contract Immutable {
    // Կոդավորման կոնվենցիա մեծատառ հաստատուն փոփոխականներին
    address public immutable MY_ADDRESS;
    uint public immutable MY_UINT;

    constructor(uint _myUint) {
        MY_ADDRESS = msg.sender;
        MY_UINT = _myUint;
    }
}

Փորձեք Remix-ում

What are your feelings