How to use bool variable in C#? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to use bool variable in C#?

I am completely new to C#, and i don't quite understand how to use the bool variable. Help?

9th Apr 2019, 1:57 PM
Милан Ковачевић
Милан Ковачевић - avatar
2 Answers
+ 3
bool is either true or false. Like: bool test = false; return test; //Prints false
9th Apr 2019, 2:58 PM
Aykut Saraç
Aykut Saraç - avatar
+ 1
Bool is used a lot in decision making. Together with a if statement. It is either true or false You can use it to have variables that are either true or false. Like IsMale HasDog
9th Apr 2019, 2:57 PM
sneeze - avatar