Bool

A bool is a type that is either true or false. Another way of saying this there is a box(type) that we will assign either a true or false value.

Here is an example:

bool groundZero = false;

Another Example is:

bool groundOne = true; 

This code is now saying that we have a type that can be identified by the variable as either groundZero or groundOne and we have assigned it a value of either true or false.

Now to display this on a console you want to add one line to the code.

Console.WriteLine(groundZero);

This will print false as it is using the variable for the false value.

If you wanted this to print the true value then replace the groundZero with groundOne inside of the brackets.

See How to display content for user for a more in depth explanation.

If you have any questions comment below!


Discover more from

Subscribe to get the latest posts sent to your email.

Leave a comment

Trending