In Dart, you can use the comparison operators to compare two numbers and produce a boolean result.
The comparison operators are:
- > : Greater Than
- < : Less Than
- >=: Greater Than or Equal To
- <=: Less Than or Equal To
- ==: Equality Check
- !=: Not Equal To
Here are some examples:
int x = 5;
int y = 10;
print(x > y); // Output: false
print(x < y); // Output: true
print(x >= y); // Output: false
print(x <= y); // Output: true
print(x == y); // Output: false
print(x != y); // Output: true
In the example above, we declared two variables x and y with initial values of 5 and 10 respectively. We then used the comparison operators to compare the values of the variables and printed the boolean result.
In the first comparison, x is not greater than y, so the output is false. In the second comparison, x is less than y, so the output is true. The same process applies to the other comparisons.