Dart Relational Operators
Dart Relational Operators
Relational operators are used to perform relational operations on the operands. This tutorial will use different relational operators in the Dart programming language.
The following table describes the symbols, operation names, and descriptions of the Dart relational operators:
Operator Symbol | Operation Name | Description |
> | Greater than | This operator checks which operand is bigger and gives the result as a Boolean expression. |
>= | Greater than or equal to | This operator checks which operand is greater or equal to each other and gives the result as a Boolean expression. |
< | Less than | This operator checks which operand is smaller and gives the result as a Boolean expression. |
<= | Less than or equal to | It checks which operand is less than or equal to each other and gives the result as a Boolean expression. |
== | Equal to | It checks whether the operands are equal to each other or not and give the result as a Boolean expression. |
!= | Not Equal to | This operator checks whether the operands are not equal to each other or not and give the result as a Boolean expression. |
Demo program
/* * Relational Operators Dart Program * Dart Tutorials - www.TestingDocs.com */ void main() { // Declare two variables int a=7; int b=9; // Greater symbol bool isGreat= a>b; print("a is greater than b is : $isGreat"); // Smaller symbol bool isLess= a<b; print("a is smaller than b is : $isLess"); //Greater than or equal to symbol bool isGreatEqual=a>=b; print("a is greater than or equal to b is : $isGreatEqual"); //Less than or equal to symbol bool isLessEqual=a<=b; print("a is smaller than or equal to b is : $isLessEqual"); //Equality symbol bool isEqual=b==a; print("a and b are equal is : $isEqual"); //Unequality symbol bool isUnEqual = b !=a; print ("a and b are not equal is : $isUnEqual"); }
Program Output
C:/tools/dart-sdk/bin/dart.exe –enable-asserts C:\Users\testingdocs\SampleDartProject\relational.dart
a is greater than b is : false
a is smaller than b is : true
a is greater than or equal to b is : false
a is smaller than or equal to b is : true
a and b are equal is : false
a and b are not equal is : true
Process finished with exit code 0
—
More information on Dart Programming language: