[Contract] Solidity 判断 mapping 值的存在
Posted Ethan Plan
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[Contract] Solidity 判断 mapping 值的存在相关的知识,希望对你有一定的参考价值。
比如 mapping(address => uint) tester,只需要判断 mapping 是否为默认值 0, tester[msg.sender] == 0
"You can think of mappings as hash tables, which are virtually initialised such that every possible key exists and is mapped to a value whose byte-representation is all zeros, a type’s default value."
Docs:https://solidity.readthedocs.io/en/v0.6.3/types.html#mapping-types
Link:https://www.cnblogs.com/farwish/p/12362647.html
以上是关于[Contract] Solidity 判断 mapping 值的存在的主要内容,如果未能解决你的问题,请参考以下文章
[Contract] Solidity 遍历 mapping 的一种方式
一基本remix环境及HelloWord contract《2022 solidity8.+ 版本教程到实战》