📜  坚固性映射 - 任何代码示例

📅  最后修改于: 2022-03-11 14:58:08.597000             🧑  作者: Mango

代码示例2
mapping(keyType => valueType)mappingName

Example
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract Mapping {
    // Mapping from address to uint
  mapping(address => uint) balance

    function get(address _addr) public view returns (uint) {
        // Mapping always returns a value.
        // If the value was never set, it will return the default value.
        return balance[_addr];
    }
}