42 - Integers
int
/ uint
: Signed and unsigned integers of various sizes. Keywords uint8
to uint256
in steps of 8 (unsigned of 8 up to 256 bits) and int8
to int256
. uint
and int
are aliases for uint256
and int256
, respectively.
Operators are:
-
Comparisons:
<=
,<
,==
,!=
,>=
,>
(evaluate tobool
) -
Bit operators:
&
,|
,^
(bitwise exclusive or),~
(bitwise negation) -
Shift operators:
<<
(left shift)>>
(right shift)
-
Arithmetic operators:
+
,-
, unary-
(only for signed integers),*
,/
,%
(modulo),**
(exponentiation)
uint
/int
Keywords- Sizes: 8 -> 256 bits
uint8
,uint16...uint256
int8
,int16..int256
- Operators: Arithemtic/Comparative/Bit/Shift
- Security: Data Flow, Underflow/Overflow