[Contract] Solidity 遍歷 mapping 的一種方式

 

思路:爲須要遍歷的 mapping 再準備一個 list,以後經過 for 循環遍歷 list 取得 mapping 的 key。html

 

mapping (address => uint) usersValueapp

mapping (uint => address) listui

uint length = xxhtm

for (uint i; i < length; i++) {blog

  usersValue[ list[i] ]get

}it

 

Ref:https://ethereum.stackexchange.com/questions/10915/could-mapping-data-structure-return-the-number-of-items-it-pointsio

Link:http://www.javashuo.com/article/p-wngasjdm-mr.html循環

相關文章
相關標籤/搜索