ALERT

[LAST CHANCE] Data Layer: Modern Business, Defined

Boolean Logical Operator

Definition - What does Boolean Logical Operator mean?

A Boolean logical operator in the context of C# programming language is an operator used to perform Boolean logic upon two Boolean expressions.

Boolean logical operators return Boolean results (true or false) and take Boolean values as operands. While performing Boolean logic, the expression on the left is evaluated, followed by the expression on the right. The two expressions are finally evaluated in the context of the Boolean logical operator between them. The return value is of Boolean type and based on the operator type used.

Techopedia explains Boolean Logical Operator

Boolean logical operators can be used to test or adjust the value of a Boolean variable. The result of the expression using these operators can be used in conditional statements to control the program flow through the code.

Boolean logical operators have precedence in the order shown below:

  1. Logical AND (&)
  2. Logical XOR (^)
  3. Logical OR (|)

It is vital to understand the difference between the & and && operators when they are used in an expression where two conditions have to be evaluated. While the & operator always executes both conditions, && does not execute the second on failure of the first. The || operator works similar to && by skipping the conditions after the first, if the first condition is true. Hence, && and || (referred to as conditional logical operators) are called short circuit operators.

The ^ operator works in a similar way to |. The | and || operators (and & and && operators) are not interchangeable since they operate differently.

This definition was written in the context of C#

Techopedia Deals

Connect with us

Techopedia on Linkedin
Techopedia on Linkedin
Tweat cdn.techopedia.com
"Techopedia" on Twitter


'@Techopedia'
Sign up for Techopedia's Free Newsletter!

Email Newsletter

Join thousands of others with our weekly newsletter

Resources
The 4th Era of IT Infrastructure: Superconverged Systems
The 4th Era of IT Infrastructure: Superconverged Systems:
Learn the benefits and limitations of the 3 generations of IT infrastructure – siloed, converged and hyperconverged – and discover how the 4th...
Approaches and Benefits of Network Virtualization
Approaches and Benefits of Network Virtualization:
Businesses today aspire to achieve a software-defined datacenter (SDDC) to enhance business agility and reduce operational complexity. However, the...
Free E-Book: Public Cloud Guide
Free E-Book: Public Cloud Guide:
This white paper is for leaders of Operations, Engineering, or Infrastructure teams who are creating or executing an IT roadmap.
Free Tool: Virtual Health Monitor
Free Tool: Virtual Health Monitor:
Virtual Health Monitor is a free virtualization monitoring and reporting tool for VMware, Hyper-V, RHEV, and XenServer environments.
Free 30 Day Trial – Turbonomic
Free 30 Day Trial – Turbonomic:
Turbonomic delivers an autonomic platform where virtual and cloud environments self-manage in real-time to assure application performance.