Skip to content

Instantly share code, notes, and snippets.

@alexroan
Last active March 24, 2020 15:28
Show Gist options
  • Save alexroan/f9009f47f3b32704eadaf99a741d4e4a to your computer and use it in GitHub Desktop.
Save alexroan/f9009f47f3b32704eadaf99a741d4e4a to your computer and use it in GitHub Desktop.
examples/solidity-data-types
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