Skip to content

Instantly share code, notes, and snippets.

@gwmccubbin
Created March 23, 2020 17:16
Show Gist options
  • Save gwmccubbin/29c2e432465a5dd39e20e8ef6ad1f9e0 to your computer and use it in GitHub Desktop.
Save gwmccubbin/29c2e432465a5dd39e20e8ef6ad1f9e0 to your computer and use it in GitHub Desktop.
Master Solidity Pt 2: Variables, Data Types, Structs
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