-
Notifications
You must be signed in to change notification settings - Fork 0
/
first_contract.sol
30 lines (20 loc) · 940 Bytes
/
first_contract.sol
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
// This is our first solidity code
// This one allow us to use the versions of solidity
pragma solidity >=0.7.0 <0.9.0;
// create a contract that can store data and return the data block
// be able to do the following:
// 1.) Receive the information, 2.) Store the information, 3.) Return the information the block
// A contract in the sense of solidity is a collection of code (its function) and data (its state) that resides at specific address on Etherium Blockchain.
contract Number {
// Write all the code inside here -- functions and its state
uint storeData;
// A function is a group of reusable code that can be used anywhere in your application.
// set and get
// public enables visibility so that we can use call this outside of the contract itself
function set(uint x) public {
storeData = x * 5;
}
function get() public view returns (uint) {
return storeData;
}
}