Created
September 9, 2021 17:33
-
-
Save josefrichter/373862b6935b8ba1052477abb7f58437 to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=undefined&optimize=false&runs=200&gist=
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.7.0 <0.9.0; | |
contract MyContract { | |
uint256 public peopleCount; | |
// Person[] public people; | |
mapping(uint => Person) public people; | |
struct Person { | |
uint _id; | |
string _firstName; | |
string _lastName; | |
} | |
function addPerson(string memory _firstName, string memory _lastName) public { | |
peopleCount += 1; | |
people[peopleCount] = Person(peopleCount, _firstName, _lastName); | |
} | |
// function addPerson(string memory _firstName, string memory _lastName) public { | |
// people.push(Person(_firstName, _lastName)); | |
// peopleCount += 1; | |
// } | |
// enum State { Waiting, Ready, Active } | |
// State public state; | |
// constructor() { | |
// state = State.Waiting; | |
// } | |
// function activate() public { | |
// state = State.Active; | |
// } | |
// function isActive() public view returns(bool) { | |
// return state == State.Active; | |
// } | |
// string value; // this is stored on blockchain | |
// constructor() { | |
// value = "My Value"; | |
// } | |
// function get() public view returns(string memory) { | |
// return value; | |
// } | |
// function set(string memory _value) public { | |
// value = _value; | |
// } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment