Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

get max type value in solidity

pragma solidity ^0.6.8;

contract TestContract {
    uint256 public a;
    uint256 public b;
    
    // replace uint256 for whatever type you require
    function myTest() external {
        a = type(uint256).min; // min value for uint256
        b = type(uint256).max; // max value for uint256
    }
}
Source by ethereum.stackexchange.com #
 
PREVIOUS NEXT
Tagged: #max #type #solidity
ADD COMMENT
Topic
Name
9+2 =