Last active
March 31, 2020 13:45
-
-
Save agoiabel/ae2c0f56c259e6a0049da26b1acd6c96 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.5.3; | |
contract{ | |
uint[] myArray; | |
function manipulateArray() external { | |
myArray.push(1); // add an element to the array | |
myArray.push(3); // add another element to the array | |
myArray[0]; // get the element at key 0 or first element in the array | |
myArray[0] = 20; // update the first element in the array | |
//we can also get the element in the array using the for loop | |
for (uint j = 0; j < myArray.length; j++) { | |
myArray[j]; | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment