# Logical Operator in Dart Programming

Dart ProgrammingServer Side ProgrammingProgramming

#### Artificial Intelligence : The Future Of Programming

15 Lectures 54 mins

#### Beyond Basic Programming - Intermediate Python

Most Popular

36 Lectures 3 hours

#### C Programming from scratch- Master C Programming

Best Seller

60 Lectures 8 hours

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 −

OperatorNameDescriptionResult
&&Logical ANDReturns true if all expressions are truex && y = false
||Logical ORReturns true is any expression is truex || y = true
!Logical NOTReturns 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 −

Live Demo

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
Updated on 21-May-2021 13:09:07