Dart - Comparison Operators
Dart provides operators that can be used to performs compare values or values within variables.
The comparison are like equal to and not equal to. Also known as equality operators.
Both comparison operators, equal to(==) and not equal to(!=) gives resultant value in boolean i.e either true or false after evaluation.
Equal to(==) operator(double equal) checks, whether operands surrounding equal to operator are same or not. Single equal is used for assigning RHS(right hand side) value or expression to LHS(left hand side).
Whereas Not equal to(!=) operator checks, whether operands surrounding not equal to operator are different or equal.
In this article, you will find Comparison operators provided by Dart.
Comparison operators
Basic comparisons performed on operands/variables with the use of equality operators.
| Operator | Description | Example |
|---|---|---|
== | Equal | x == y |
!= | Not Equal | x != y |
- All of these listed operators are binary operators.
- All these operators also follow the general structure of
OperandOperatorOperand, meaning that an operator is always surrounded by two operands. - For example, an expression
x == yis a binary operation, where x and y are the two operands and == is an operator. If value ofx&yare same then you will gettrueas value elsefalse.
Hope you like this!
Keep helping and happy 😄 coding