solidity学习一
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; contract SimpleStorage { uint256 public fnumber; // People public person=People({fnumber:2,name:"xiang"}); struct People{ uint256 fnumber; string name; } People[] public perple; mapping(string=>uint256) public nameToFnumber; function store(uint256 _fnumber) public { fnumber = _fnumber; } function retrieve()public view returns(uint256){ return fnumber; } function addPerson(string memory _name,uint256 _fnumber)public{ People memory newPerson=People({fnumber:_fnumber,name:_name}); perple.push(newPerson); nameToFnumber[_name]=_fnumber; } }