Last active
March 24, 2020 15:28
-
-
Save alexroan/f9009f47f3b32704eadaf99a741d4e4a to your computer and use it in GitHub Desktop.
examples/solidity-data-types
This file contains hidden or 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.5.0; | |
contract DataTypes { | |
// Boolean | |
bool trueOrFalse; | |
// Unsigned integer. default size is 256 | |
uint firstInteger; | |
// The same as above, with definition | |
uint256 secondInteger; | |
// Signed integer, 128 | |
int128 thirdinteger; | |
// Address, add keywork 'payable' to be able to send ether to it | |
address myAddress; | |
// Two byte array | |
bytes2 twoBytesArray; | |
// Sixteen byte array | |
bytes16 sixteenBytesArray; | |
// String | |
string myString; | |
// Array of strings (can be an array of any other data type) | |
string[] myStringArray; | |
// Enums | |
enum direction { left, right, up, down } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment