
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Logical Operator in Dart Programming
Logical operators in dart are used when we want to evaluate expressions by putting conditional statements in between them, which ultimately results in a Boolean value.
Logical operators are only applied on Boolean operands.
There are three types of logical operators that are present in Dart. In the table below all of them are mentioned along with their name and the result they produced when they are used on two Boolean operands.
Let's consider two Boolean variables named, x and y, with values true and false respectively.
Consider the table shown below −
Operator | Name | Description | Result |
---|---|---|---|
&& | Logical AND | Returns true if all expressions are true | x && y = false |
|| | Logical OR | Returns true is any expression is true | x || y = true |
! | Logical NOT | Returns compliment of the expression | !x = false |
Let's make use of all the above mentioned logical operators in a Dart program.
Example
Consider the example shown below −
void main(){ var x = true, y = false; print("x && y is: ${x && y}"); print("x || y is: ${x || y}"); print("!x is: ${!x}"); }
Output
x && y is: false x || y is: true !x is: false
Advertisements