-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproblem1.sol
More file actions
22 lines (16 loc) · 873 Bytes
/
Copy pathproblem1.sol
File metadata and controls
22 lines (16 loc) · 873 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Problem 1
//Write a Solidity program that prints the message "Hello Web3 World". Save the message in a variable named "greet".
//SPDX-License-Identifier: MIT
// This line specifies the license under which the code is distributed.
// In this case, it's the MIT license.
pragma solidity ^0.8.3;
// This line specifies the version of Solidity that the code is written in.
// In this case, it's version 0.8.3.
contract HelloWorld {
// This line declares the contract called "HelloWorld".
string public greet = "Hello Web3 World";
// This line declares a public variable called "greet", which is of type string.
// The value of "greet" is set to "Hello".
// The "public" keyword makes the variable visible outside of the contract and allows anyone to read its value.
// However, only the contract itself can modify the value of the variable.
}