What are Boolean Operators below i didn't understand it in C# | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What are Boolean Operators below i didn't understand it in C#

bool IsOpen = true ;

16th Jan 2024, 11:05 AM
Ari Chan
Ari Chan - avatar
2 Answers
+ 2
Here, bool IsOpen = true ; Means " IsOpen is a boolean type variable and assigned true value ". Boolean variables can hold either true or false values only.. In C#, boolean operators results in a boolean value only.. The logical operators, ( &, |, !, &&,|| ) and conditional operators( >, <, !=, ==, ..... ) are results in boolean values after it's evaluation.
16th Jan 2024, 4:29 PM
Jayakrishna 🇮🇳
+ 1
Caution, Jayakrishna 🇮🇳, in c# bitwise operators (&, |) are not classified as Boolean operators. Boolean operators are meant to operate on Boolean operands and return a True/False result, whereas bitwise operators operate on integral values and return an integral result.
16th Jan 2024, 9:31 PM
Brian
Brian - avatar