Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save glaksmono/473992f0655bbf9c841475595ce8a5af to your computer and use it in GitHub Desktop.
Save glaksmono/473992f0655bbf9c841475595ce8a5af to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.6.0+commit.26b70077.js&optimize=false&runs=200&gist=
pragma solidity ^0.6.0;
contract SimpleMappingExample {
mapping(uint => bool) public myMapping;
mapping(address => bool) public myAddressMapping;
mapping(uint => mapping(uint => bool)) uintUintBoolMapping;
function setValue(uint _index) public {
myMapping[_index] = true;
}
function setAddressMapping() public {
myAddressMapping[msg.sender] = true;
}
function setUintUintBoolMapping(uint _index1, uint _index2) public {
uintUintBoolMapping[_index1][_index2] = true;
}
function getUintUintBoolMapping(uint _index1, uint _index2) public view returns (bool) {
return uintUintBoolMapping[_index1][_index2];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment