-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimpleStorage.sol
More file actions
52 lines (43 loc) · 1.44 KB
/
SimpleStorage.sol
File metadata and controls
52 lines (43 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// SPDX-License-Identifier: Unlicensed
pragma solidity >=0.6.0 <0.9.0;
contract SimpleStorage {
uint256 favoritenumber;
function store(uint256 _favoritenumber) public returns (uint256) {
favoritenumber = _favoritenumber;
return _favoritenumber;
}
function retrieve() public view returns (uint256) {
return favoritenumber;
}
/*
uint256 favoritenumber2;
function store2(uint256 _favoritenumber2) public{
favoritenumber2 = _favoritenumber2;
}
function retrieve2() public view returns(uint256){
return favoritenumber2;
}
uint256 favoritesoma;
/*
/*
function soma() public{
favoritesoma = favoritenumber + favoritenumber2;
}
function returnsoma() public view returns(uint256){
return favoritesoma;
}
*/
struct People {
uint256 favoritenumber;
string name;
}
bool favoritebool;
People[] public people;
//people public person = people({favoritesoma:100, name:"Patricia"});
mapping(string => uint256) public nametofavoritenumber;
function addperson(string memory _name, uint256 _favoritenumber) public {
people.push(People(_favoritenumber, _name));
nametofavoritenumber[_name] = _favoritenumber;
} // we can store things in "memory" or in "storage".
//Memory means that after this exection it will leave it; Storage will keep it forever
}