Created
December 5, 2021 14:23
-
-
Save dhananjayhegde/9acce90a42e2ceeb492e39ee3b7c4456 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=soljson-v0.8.1+commit.df193b15.js&optimize=undefined&runs=undefined&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
//SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.1; | |
contract SimpleStorage{ | |
struct People { | |
uint256 favoriteNumber; | |
string name; | |
} | |
People[] public people; | |
mapping(string => uint256) public nameToFavNum; | |
function addPerson(string memory _name, uint256 _favoriteNumber) public { | |
people.push( People( {favoriteNumber: _favoriteNumber, name: _name} ) ); | |
nameToFavNum[_name] = _favoriteNumber; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment