84 - Integer Type
For an integer type T
, the following type information is available:
-
type(T).min
: The smallest value representable by type T. -
type(T).max
: The largest value representable by type T.
type(X)
- X -> Integer
type(T).min
- Smallest Value of T
type(T).max
- Largest Value of T
- E.g.:
type(uint8).max == 255
pragma solidity ^0.8.0;
contract MinMax {
function testInt() public returns(int, int){
return(type(int).min,type(int).max);
}
function testUint() public returns(uint, uint) {
return(type(uint).min,type(uint).max);
}
}