Dart Equality & Relational Operators

Dart Equality & Relational Operators

1. Equality Operators:

\==Equal toThis operator is used to test if two values are equal.
!=Not Equal toThis operator is used to test if two values are not equal.

Example:

==

  • In this example, the equality operator checks whether the value of variable a is equal to the value of variable b. If the values are equal, the result is true; otherwise, it is false.

!=

  • In this example, the inequality operator checks whether the value of variable a is not equal to the value of variable b. If the values are different, the result is true; otherwise, it is false

2. Relational Operators

>Greater Than OperatorTests if the left value is greater than the right value.
<Less Than OperatorTests if the left value is less than the right value.
\>=Greater than or Equal to OperatorTests if the left value is greater than or equal to the right value
<=Less than or Equal to OperatorTests if the left value is less than or equal to the right value.

Example: