Created
July 27, 2018 21:44
-
-
Save nodlAndHodl/b16e8987dec7ece2d7b6a09137ea8af2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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