solidity基础-Map
Map
例子
contract MapTest { mapping(address => uint256) public account; function getAccount(address _addr) public view returns (uint256){ return account[_addr]; } function sender(address _addr, uint256 amount) public { account[_addr] = account[_addr] + amount; } function remove(address addr) public{ delete account[addr]; } }
部署输出
往该地址发送15, 可以看到该地址就有15了。