
False is not true. The false keyword in the C# language is a constant boolean literal, meaning it is a value that can be stored in a variable. It can also be evaluated in an if-expression.
KeywordsThis C# example considers the false constant. This article notes some issues related to true and false.

Let's explore some uses of the false literal. In the first if-statement, we see that when an expression evaluates to false, the code inside the if-block is not reached. You can set a bool variable to false. You can invert the value of a bool variable with the ! operator; false is changed to true. Finally, the expression != false is equal to == true; this can be omitted entirely.
Program that uses false literal [C#]
using System;
class Program
{
static void Main()
{
// Unreachable.
if (false)
{
Console.WriteLine(); // Not executed.
}
// Use boolean to store true and false.
bool value = true;
Console.WriteLine(value); // True
value = false;
Console.WriteLine(value); // False
value = !value;
Console.WriteLine(value); // True
// Expressions can be stored in variables.
bool result = (1 == int.Parse("1")) != false;
Console.WriteLine(result); // True
}
}
Output
True
False
True
True
We made note of the false literal constant in the C# programming language. It is usually clearer to express conditions in terms of truth rather than testing against false, but sometimes false may be clearer. For example, if false is the expected result, using == false may be better. False can be stored in the bool variable type.
True Value Bool Type