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
| { | |
| "SimpleStorage.sol": { | |
| "__sources__": { | |
| "SimpleStorage.sol": { | |
| "content": "// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.18;\r\n\r\ncontract SimpleStorage{\r\n\r\n uint256 public myFavoriteNumber; //default value of unint256 is 0 and the default value of a state varibale is internal\r\n uint256[] listOfFavNumbers;\r\n\r\n struct Person{\r\n uint256 favoriteNumber;\r\n string name;\r\n \r\n }\r\n\r\n Person public james = Person({favoriteNumber: 2, name: \"James\"});\r\n Person[] public myPeople;\r\n mapping(string => uint256) public nameToFavoriteNumber; //mapping is a key value pair (hash table)\r\n\r\n function store(uint256 _favNumber) public {\r\n myFavoriteNumber = _favNumber;\r\n }\r\n function retrieve() public view returns(uint256){\r\n return myFavoriteNumber;\r\n }\r\n function addPerson(uint256 _favNum, string memory _name) public {\r\n myPeople.push(Person(_favNum, _name));\r\n |