-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathday23.sol
More file actions
39 lines (34 loc) · 738 Bytes
/
Copy pathday23.sol
File metadata and controls
39 lines (34 loc) · 738 Bytes
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
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0 <0.9.0;
contract Day23 {
struct Book {
string title;
string author;
uint256 book_id;
}
Book[5] books;
uint256 counter = 1;
function setBook(
string memory _title,
string memory _author,
uint256 _id
) public {
books[counter] = Book(_title, _author, _id);
counter++;
}
function getBook(uint256 _counter)
public
view
returns (
string memory,
string memory,
uint256
)
{
return (
books[_counter].title,
books[_counter].author,
books[_counter].book_id
);
}
}