C# Booleans

In this lesson, you will learn about C# Booleans, their usage, and examples to better understand the topic.


C# Booleans Type

The C# Boolean, or bool type, is a datatype that has only two possible values, True or False.

In programming, you will run by scenarios where you want to set a specific variable to either true or false. This is where the Boolean type is used.

Example

Boolean isValid;

In C#, the default value of Boolean variable is false.

Boolean Expression

In C#, comparing two values or variables return a Boolean expression.

Example

This concludes the C# Booleans lesson. In the next lesson, you will learn about if statements in C#.