Last active
March 24, 2020 15:21
-
-
Save alexroan/61a4f6962d891d27b71f5f8bf9ca83cb to your computer and use it in GitHub Desktop.
examples/solidity-structs
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.0; | |
contract Structs { | |
// Define the Person struct | |
struct Person { | |
string name; | |
uint8 age; | |
} | |
// Create a new person struct, | |
// Access the age of the struct | |
function personAge() external pure returns(uint8) { | |
Person memory person = Person("Alex", 27); | |
// Will return 27 | |
return person.age; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment