This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.0; | |
contract MappyingContract{ | |
mapping(uint => uint[])luckyNumbers; | |
mapping(address => uint [])addNumbers; | |
uint[] numbers; | |
constructor() public{ | |
luckyNumbers[0] = [1,2,3,4]; | |
luckyNumbers[1] = [1,2,3,5]; | |
luckyNumbers[2] = [1,2,3,6]; | |
luckyNumbers[3] = [1,2,3,7]; | |
} | |
function getLuckyNumbers(uint key)public constant returns(uint[]){ | |
return luckyNumbers[key]; | |
} | |
function addLuckyNumbers()public view returns(uint){ | |
numbers.length; | |
} | |
function pushTo(uint key, uint val) public returns (uint[]){ | |
uint [] arr =luckyNumbers[key]; | |
arr.push(val); | |
luckyNumbers[key] = arr; | |
return arr; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment