Relational operators
We can use relational operators when we want to compare two variables. In the following table, we can see the relational operators in Dart:
| Name | Operator | Description | 
|---|---|---|
| Equal to | a == b | Check if ais equal tob | 
| Not equal to | a != b | Check if ais not equal tob | 
| Greater than | a > b | Check if ais greater thanb | 
| Less than | a < b | Check if ais less thanb. | 
| Less or equal to | a <= b | Check if ais less or equal tob | 
| Greater or equal to | a >= b | Check if ais greater or equal tob | 
With equal to (==) and not equal to (!=), we can check if two variables are equal or not equal, for example:
int a = 10;
int b = 15;
if (a == b) {
  print('a is equal to b');
}
if (a != b) {
  print('a is not equal to b');
}
Sometimes we also want to know if the variable is greater than or less than. To do it we can use the rest of the operators, for example:
int a = 10;
int b = 15;
if (a > b) {
  print('a is greater than b');
}
if (a < b) {
  print('a is less than b');
}
if (a >= b) {
  print('a is greater or equal to b');
}
if (a <= b) {
  print('a is less or equal to b');
}
Let's take a look at the previous examples in DartPad: