So many ways, and one more (nullable bool)

Raymond was walking us back in 2004 through the history of boolean in programming. Some reader commented that he overlooked C# / managed code bringing up its own bool or System.Boolean

But even more interesting, C#, who originally simplified bool in the way that they may only be ‘true’ or ‘false’ with no funky C/C++ ‘false’ is 1 and ‘true’ is anything else yet I define ‘true’ to 1, now adds more complexity with nullable bool (declared as bool? _myVariableName_;). Now (nullable) bool can be true, false, or null (i.e. “I don’t know”). So if (!(_myVariableName_ == true)) does not only include the case where the boolean is false, but also the case where the boolean is null.

Link | This entry was posted in Computers and Internet, Microsoft, Ordinateurs et Internet, Travail, work. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s