C# Programming

Logical Operators

C# Programming / Logical Operators

Logical Operators

What Are Logical Operators in C#?

C# logical operators evaluate multiple conditions and return either true or false. When you need to check multiple conditions, you can combine them using these operators. These operators are helpful for decision-making, loops, and data validation in programming.

List of Logical Operators

Following table shows all the logical operators supported by C#. Assume variable A holds Boolean value true and variable B holds Boolean value false, then −

OperatorSymbolDescriptionExample
Logical AND&&Called Logical AND operator. If both the operands are non zero then condition becomes true.(A && B) is false.
Logical OR||Called Logical OR Operator. If any of the two operands is non zero then condition becomes true.(A || B) is true.
Logical NOT!Called Logical NOT Operator. Use to reverses the logical state of its operand. If a condition is true then Logical NOT operator will make false.!(A && B) is true.
Technology
C# Programming
want to connect with us ?
Contact Us