Equality and Relational Operators

  • Post author:
  • Post category:Dart
  • Post comments:1 Comment
dart programming Equality and Relational Operators

In this guide, we will discuss Equality and Relational Operators in Dart Programming Language.

Example

The following example shows how you can use Equality and Relational operators in Dart −

void main() { 
   var num1 = 5; 
   var num2 = 9; 
   var res = num1>num2; 
   print('num1 greater than num2 ::  ' +res.toString()); 
   
   res = num1<num2; 
   print('num1 lesser than  num2 ::  ' +res.toString()); 
   
   res = num1 >= num2; 
   print('num1 greater than or equal to num2 ::  ' +res.toString()); 
   
   res = num1 <= num2; 
   print('num1 lesser than or equal to num2  ::  ' +res.toString()); 
   
   res = num1 != num2; 
   print('num1 not equal to num2 ::  ' +res.toString()); 
   
   res = num1 == num2; 
   print('num1 equal to num2 ::  ' +res.toString()); 
} 

It will produce the following output −

num1 greater than num2 ::  false 
num1 lesser than num2 ::  true 
num1 greater than or equal to num2 ::  false 
num1 lesser than or equal to num2  ::  true 
num1 not equal to num2 ::  true 
num1 equal to num2 ::  false 

Next Topic : Click Here

This Post Has One Comment

Leave a Reply