0
What is bool?
8 odpowiedzi
+ 3
true and false or 1 and 0
+ 3
The bool keyword is an alias of System.Boolean. It is used to declare variables to store the Boolean values, true and false.
+ 2
bool is short term for boolean.
boolean represents expression that results to TRUE or FALSE.
+ 2
And is a value type wich cant be null
+ 2
public class BoolTest
{
static void Main()
{ bool b = true;
// WriteLine automatically converts the value of b to text. Console.WriteLine(b); int days = DateTime.Now.DayOfYear;
// Assign the result of a boolean expression to b. b = (days % 2 == 0);
// Branch depending on whether b is true or false.
if (b)
{
Console.WriteLine("days is an even number");
}
else { Console.WriteLine("days is an odd number");
}
}
}
/* Output: True days is an <even/odd> number */
0
it's logical variable ( yes , no )
0
You can do
bool x = true;
or
bool y = false;
0
bool (boolean) is a data type which stores true/false values.