#21 – Boolean Literals

A boolean literal is represented by one of two keywords–either true or false.  A boolean literal is always of type bool.

Here are a few examples:

 bool happy = true;
 bool rich = false;
 if (happy == true) Console.WriteLine("Happy guy");
 File.Copy(@"C:\From.txt", @"C:\To.txt", false);  // don't overwrite
 while (true) Console.WriteLine("Loop forever");

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

Leave a comment