Created
August 1, 2022 15:00
-
-
Save devlongs/26c998b646c11c1e321549becce753af 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
| // SPDX-License-Identifier: MIT | |
| pragma solidity ^0.8.8; | |
| contract SimpleStorage { | |
| uint256 favoriteNumber; | |
| mapping(string => uint256) public nameToFavoriteNumber; | |
| struct People { | |
| uint256 favoriteNumber; | |
| string name; | |
| } | |
| People[] public people; | |
| function store(uint256 _favoriteNumber) public { | |
| favoriteNumber = _favoriteNumber; | |
| } | |
| function retrieve() public view returns (uint256) { | |
| return favoriteNumber; | |
| } | |
| function addPerson(string memory _name, uint256 _favoriteNumber) public { | |
| people.push(People(_favoriteNumber, _name)); | |
| nameToFavoriteNumber[_name] = _favoriteNumber; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment