Created
March 23, 2020 17:16
-
-
Save gwmccubbin/29c2e432465a5dd39e20e8ef6ad1f9e0 to your computer and use it in GitHub Desktop.
Master Solidity Pt 2: Variables, Data Types, Structs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.6.0; | |
contract MyContract { | |
string public myString = "Hello, world!"; | |
bytes32 public myBytes32 = "Hello, world!"; | |
int public myInt = 1; | |
uint public myUint = 1; | |
uint256 public myUint256 = 1; | |
uint8 public myUint8 = 1; | |
address public myAddress = 0x5A0b54D5dc17e0AadC383d2db43B0a0D3E029c4c; | |
// We'll cover arrays later | |
// We'll cover mappings later | |
struct MyStruct { | |
uint myUint; | |
string myString; | |
} | |
MyStruct public myStruct = MyStruct(1, "Hello, World!"); | |
// Local variable | |
function getValue() public pure returns(uint) { | |
uint value = 1; | |
return value; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment