I want to use two dimensional mapping or array but one key should be address and the other key is a number ,how can I do this? Similar to Mapping (address , uint256=> unit) How to do it? Use struct? Thanks


You can have a mapping of a mapping.

mapping (address => mapping(uint256 => uint256))

  • Because mapping uint256=>uint256 will be different for each key address in this way 0x123=>(2=>99) and 0x234=>(2=>99) should be different since actually it is a kind of two dimensional array similar like value[0x1234][2] – Louis Nov 28 '18 at 11:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.