Dart Equality and relational operators

Dart Equality and relational operators

ยท

2 min read

  • This type operators are use for comparation between two more variables.

Here, I have mentioned operator and their meaning and in last I have put example as well to better understand.

Operator SymbolOperator NameOperator Description
>Greater thanCheck which operand is bigger and give result as boolean expression.
<Less thanCheck which operand is smaller and give result as boolean expression.
>=Greater than or equal toCheck which operand is greater or equal to each other and give result as boolean expression.
<=less than equal toCheck which operand is less than or equal to each other and give result as boolean expression.
\==Equal toCheck whether the operand are equal to each other or not and give result as boolean expression.
!=Not Equal toCheck whether the operand are not equal to each other or not and give result as boolean expression.
void main(){
   var x = 20, y = 30;
   print("x > y is: ${x > y}");
   print("x < y is: ${x < y}");
   print("x >= y is: ${x >= y}");
   print("x <= y is: ${x <= y}");
   print("x == y is: ${x == y}");
   print("x != y is: ${x != y}");
}

/* Output 

x > y is: false
x < y is: true
x >= y is: false
x <= y is: true
x == y is: false
x != y is: true
*/

Did you find this article valuable?

Support Vinit Mepani (Flutter Developer) by becoming a sponsor. Any amount is appreciated!

ย