-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path002-variable-and-types.sol
35 lines (25 loc) · 1.03 KB
/
002-variable-and-types.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
31
32
33
34
35
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
// variables are used to store information to be referenced
// or manipulated by our program
// Mostly used and three main variable types:
// Boolean - keyword: bool - Example values: true, false
// Integer - keyword: uint - Example values: signed and unsigned integers with varying sizes
// String - keyword: string - Example values: data values that are made up of a sequence of characters
// isAdmin = boolean - checks if a user is an admin
// walletAmount = integer, total amount in users wallet
// errorMessage = a string containing a description of what went wrong
contract LearnVariables {
// our solidity code
// declaring an integer variable
uint256 chocolateBar = 100;
// string variables
string storeOwner = "Prince Junior";
string errorMessage = "Not an Admin";
// boolean variable
bool isAdmin = true;
// exercise
uint256 wallet = 300;
bool spent = false;
string notififySpend = "You spent an amount of money";
}