# CBool
{: .no_toc }

Coerces an expression to a **Boolean**.

Syntax: **CBool(** *expression* **)**

*expression*
: *required* Any valid string or numeric expression.

The return type is **Boolean**. If *expression* evaluates to a nonzero value, **CBool** returns **True**; otherwise, it returns **False**.

The data-type conversion functions document code by showing that the result of some operation should be expressed as a particular data type rather than the default data type.

### Common Errors

| Error | When |
|---|---|
| [6 (`&H6`)](/Reference/Run-time-Errors.md#6), *Overflow* | *expression* is a string that holds a number outside the range of a **Double** |
| [13 (`&HD`)](/Reference/Run-time-Errors.md#13), *Type mismatch* | *expression* is a string that is not a number, **True** or **False** (a zero-length string included) |
| [94 (`&H5E`)](/Reference/Run-time-Errors.md#94), *Invalid use of Null* | *expression* is **Null** |

### Example

This example uses the **CBool** function to convert an expression to a **Boolean**.

```tb check_build
Dim A, B, Check
A = 5: B = 5             ' Initialize variables.
Check = CBool(A = B)     ' Check contains True.

A = 0                    ' Define variable.
Check = CBool(A)         ' Check contains False.
```

### See Also

- [CByte](/tB/Modules/Conversion/CByte.md), [CInt](/tB/Modules/Conversion/CInt.md), [CLng](/tB/Modules/Conversion/CLng.md), [CDbl](/tB/Modules/Conversion/CDbl.md), [CSng](/tB/Modules/Conversion/CSng.md), [CStr](/tB/Modules/Conversion/CStr.md), [CVar](/tB/Modules/Conversion/CVar.md) functions
