mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-08-11 17:24:29 +02:00
Cleaned up data types
This commit is contained in:
@@ -117,12 +117,10 @@ uint x;
|
|||||||
|
|
||||||
// int of 256 bits, cannot be changed after instantiation
|
// int of 256 bits, cannot be changed after instantiation
|
||||||
int constant a = 8;
|
int constant a = 8;
|
||||||
|
|
||||||
// with 'constant', compiler replaces each occurrence with actual value
|
|
||||||
int256 constant a = 8; // same effect as line above, here the 256 is explicit
|
int256 constant a = 8; // same effect as line above, here the 256 is explicit
|
||||||
uint constant VERSION_ID = 0x123A1; // A hex constant
|
uint constant VERSION_ID = 0x123A1; // A hex constant
|
||||||
|
// with 'constant', compiler replaces each occurrence with actual value
|
||||||
|
|
||||||
// Be careful that you don't overflow, and protect against attacks that do
|
|
||||||
|
|
||||||
// For int and uint, can explicitly set space in steps of 8 up to 256
|
// For int and uint, can explicitly set space in steps of 8 up to 256
|
||||||
// e.g., int8, int16, int24
|
// e.g., int8, int16, int24
|
||||||
@@ -130,6 +128,8 @@ uint8 b;
|
|||||||
int64 c;
|
int64 c;
|
||||||
uint248 e;
|
uint248 e;
|
||||||
|
|
||||||
|
// Be careful that you don't overflow, and protect against attacks that do
|
||||||
|
|
||||||
// No random functions built in, use other contracts for randomness
|
// No random functions built in, use other contracts for randomness
|
||||||
|
|
||||||
// Type casting
|
// Type casting
|
||||||
|
Reference in New Issue
Block a user