Created
December 24, 2019 19:54
-
-
Save marsrvr/5d15ed4f7c9d22d20eabb40c21554c40 to your computer and use it in GitHub Desktop.
Solidity Structure Demo
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.5.12; | |
contract StructDemo{ | |
// stack variables | |
struct Person{ | |
string name; | |
string species; | |
uint age; | |
uint height; | |
uint uid; | |
} | |
Person[] public people; | |
// functions | |
function createPerson(string memory name, string memory species, uint age, uint height) public{ | |
people.push(Person(name, species, age, height,people.length)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment