Skip to content

Instantly share code, notes, and snippets.

@marsrvr
Created December 24, 2019 19:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marsrvr/5d15ed4f7c9d22d20eabb40c21554c40 to your computer and use it in GitHub Desktop.
Save marsrvr/5d15ed4f7c9d22d20eabb40c21554c40 to your computer and use it in GitHub Desktop.
Solidity Structure Demo
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