Dart Programming – Bitwise Operators

  • Post author:
  • Post category:Dart
  • Post comments:2 Comments
Dart Programming bitwise Operators

In this guide, we will discuss Bitwise Operators in Dart Programming Language.

Example

The following example shows how you can use the bitwise operators in Dart −

void main() { 
   var a = 2;  // Bit presentation 10 
   var b = 3;  // Bit presentation 11 
   
   var result = (a & b); 
   print("(a & b) => ${result}");    
   result = (a | b); 
   print("(a | b) => ${result}");
   result = (a ^ b); 
   print("(a ^ b) => ${result}"); 
   
   result = (~b); 
   print("(~b) => ${result}");  
   
   result = (a < b); 
   print("(a < b) => ${result}"); 
   
   result = (a > b); 
   print("(a > b) => ${result}"); 
}  

It will produce the following output −

(a & b) => 2
(a | b) => 3 
(a ^ b) => 1           
(~b) => -4             
(a < b) => true                             
(a > b) => false

Next Topic : Click Here

This Post Has 2 Comments

Leave a Reply