其他分享
首页 > 其他分享> > Soldity0.8-Constants

Soldity0.8-Constants

作者:互联网

Constants are variables that cannot be modified.

Their value is hard coded and using constants can save gas cost.

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

contract Constants {
    // coding convention to uppercase constant variables
    address public constant MY_ADDRESS = 0x777788889999AaAAbBbbCcccddDdeeeEfFFfCcCc;
    uint public constant MY_UINT = 123;
}

标签:0.8,constant,variables,Soldity0.8,MY,public,Constants
来源: https://www.cnblogs.com/zaleswift/p/16538502.html