Skip to content

Latest commit

 

History

History
37 lines (32 loc) · 831 Bytes

Integer Type.md

File metadata and controls

37 lines (32 loc) · 831 Bytes

For an integer type T, the following type information is available:

  1. type(T).min: The smallest value representable by type T.

  2. type(T).max: The largest value representable by type T.


Slide Screenshot

084.jpg


Slide Deck

  • type(X)
  • X -> Integer
  • type(T).min
    • Smallest Value of T
  • type(T).max
    • Largest Value of T
  • E.g.: type(uint8).max == 255

References


Code Example

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);
    }
}