Boolean values: Difference between revisions
m
C# Removed the remark about C#8 nullable types because it does not apply to bool.
m (→{{header|Phix}}: conversely not "=true") |
m (C# Removed the remark about C#8 nullable types because it does not apply to bool.) |
||
Line 708:
=={{header|C sharp|C#}}==
In C#, there are the reserved keywords <code>true</code> and <code>false</code>. Variables to hold these values are declared as either <code>bool</code> or <code>Boolean</code>. These types are identical, as <code>bool</code> is just
So, when applied to <code>bool</code>, we have a <code>bool?</code> type that supports 3 values: <code>true</code>, <code>false</code> and <code>null</code>. This can be useful for some applications where the value can be undefined or missing.
<lang csharp>bool? value = null</lang>
|