Comparison Operators in Solidity Read Courses Practice Improve Improve Improve Like Article Like Save Article Save Report issue Report Comparison Operators are used to compare two values. Solidity has the following types of comparison operators: Greater than: Greater than operator compares two operands. It evaluates to true when the left operand is greater than the right operand otherwise false. It is denoted by >.Lesser than: Lesser than operator compares two operands. It evaluates to true when the left operand is lesser than the right operand otherwise false. It is denoted by <.Greater than equal to: Greater than equal to operator compares two operands. It evaluates to true when the left operand is greater than or equal to the right operand otherwise false. It is denoted by >=.Lesser than equal to: Lesser than equal to operator compares two operands. It evaluates to true when the left operand is lesser than or equal to the right operand otherwise false. It is denoted by <=.Equal: An equal operator compares two operands. It evaluates to true if both the operands are equal otherwise false. It is denoted by ==.Not equal: Not equal operator compares two operands. It evaluates to true if both the operands are unequal otherwise false. It is denoted by !=.OperatorDenotationDescriptionGreater than> Evaluates to true if the left operand is greater than the right operand.Lesser than< Evaluates to true if the left operand is lesser than the right operand.Greater than equal to>= Evaluates to true if the left operand is greater than or equal to the right operand.Lesser than equal to <= Evaluates to true if the left operand is less than or equal to the right operand.Equal == Evaluates to true if the left operand is equal to the right operand.Not equal!= Evaluates to true if the left operand and right operand are unequal. Below is the Solidity program to implement Comparison Operators: Solidity // Solidity program to implement // Comparison Operator pragma solidity ^0.5.0; contract Comparison { function comparisonoper (uint a, uint b) public pure returns (bool, bool, bool, bool, bool, bool) { // Greater than Comparison Operator bool gt = a > b; // Lesser than Comparison Operator bool lt = a < b; // Greater than equal to Comparison Operator bool gtet = a >= b; // Lesser than equal to Comparison Operator bool ltet = a <= b; // Equal Comparison Operator bool e = a == b; // Not equal Comparison Operator bool ne = a != b; return (gt, lt, gtet, ltet, e, ne); } } Output: Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now! Last Updated : 21 Mar, 2023 Like Article Save Article Previous Bytes in Solidity Next If Statement in Solidity Share your thoughts in the comments Add Your Comment Please Login to comment...