码迷,mamicode.com
首页 > 移动开发 > 详细

[Contract] Solidity 判断 mapping 值的存在

时间:2020-02-25 17:30:10      阅读:131      评论:0      收藏:0      [点我收藏+]

标签:href   intern   blank   end   ESS   tab   pes   默认   存在   

 

比如 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 值的存在

标签:href   intern   blank   end   ESS   tab   pes   默认   存在   

原文地址:https://www.cnblogs.com/farwish/p/12362647.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!