Skip to content

Instantly share code, notes, and snippets.

@bertil291utn
Created June 11, 2022 18:20
Show Gist options
  • Save bertil291utn/d94cb48660f8e589a03eac8fc5f359ab to your computer and use it in GitHub Desktop.
Save bertil291utn/d94cb48660f8e589a03eac8fc5f359ab 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.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.3;
contract SimpleStorage{
uint256 age;
struct Humans{
uint256 age;
string name;
}
Humans [] public boys;
mapping(string=>uint256) public humansByName;
function incrementAge(uint256 _age) public virtual{
age=_age;
}
function getAge() public view returns (uint256){
return age;
}
function addPeople(string memory _name, uint256 _age) public{
boys.push(Humans(_age,_name));
humansByName[_name]=_age;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment