Iterasi loop atas pemetaan dalam soliditas
// Answer 1
// initialise a counter and an mapping in addition to the mapping you intend to iterate over
uint counter; // you should initialize this to 0 in the constructor
// the value in the countToAddress mapping points to the key in the next mapping
mapping (uint => address) private countToAddress;
// intend to iterate over the addressToValue mapping:
mapping (address => uint) private addressToValue;
function iterateOverAddressToValue() public {
uint currentValue;
for (uint i=0; i < counter; i++) {
currentValue = addressToValue[countToAddress[i]];
}
}
Anxious Alligator