Solidity : Non-strict comparison with zero

Classification

Overview

Variables of uint type cannot be negative. Thus, comparing uint variable with zero (greater than or equal) is redundant. Also, it may lead to an underflow issue. Moreover, comparison with zero used in for-loop condition results in an infinite loop.

References

  1. Overflow and Underflow in Solidity