Question: I was wondering what was the most clean and understandable syntax for doing condition checks on nullable bools. 

Is the following good or bad coding style? Is there a way to express the condition better/more cleanly?

```
bool? nullableBool = true;
if (nullableBool ?? false) { ... }
else { ... }

```

especially the **if (nullableBool ?? false)** part. I don't like the `if (x.HasValue && x.Value)` style ...

*(not sure whether the question has been asked before ... couldn't find something similar with the search)*

Answer: 
How about using [GetValueOrDefault](http://msdn.microsoft.com/en-us/library/3d6d4f1d(v=VS.100).aspx), which is pretty self-explaining and allows to use whatever default you want:

```
if (nullableBool.GetValueOrDefault(false)) {
}

```
Lets check how the comparison with null is defined:

```
static void Main()
    {
        Console.WriteLine($"null != null  => {null != null}");
        Console.WriteLine($"null == null  => {null == null}");
        Console.WriteLine($"null != true  => {null != true}");
        Console.WriteLine($"null == true  => {null == true}");
        Console.WriteLine($"null != false => {null != false}");
        Console.WriteLine($"null == false => {null == false}");
    }

```

and the results are:

```
null != null  => False                                                                                                                                                                                                                                  
null == null  => True                                                                                                                                                                                                                                   
null != true  => True                                                                                                                                                                                                                                   
null == true  => False                                                                                                                                                                                                                                  
null != false => True                                                                                                                                                                                                                                   
null == false => False

```

So you can safely use:

```
// check if null or false
if (nullable != true) ...

// check if null or true
if (nullable != false) ...

// check if true or false
if (nullable != null) ...

```