> For the complete documentation index, see [llms.txt](https://docs.engagevr.io/developer/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.engagevr.io/developer/afx/node-dictionary/variable/bool.md).

# Bool

## Boolean cast nodes

You can use a Boolean cast node to convert a Boolean value to a float, an integer, or a string. In each case you can choose how the Boolean true or false value is represented in the target type.

For example, the default outputs for the Bool To String node are "true" and "false", but you could change them to "on" and "off", or "open" and "closed", or any other pair of strings.

<figure><img src="https://2640392766-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5yxYHsXtlAaoMUrDWhLm%2Fuploads%2Fgit-blob-7e2fba654dfefe04f97a81c73b5775feb59acbdb%2Fafx_node_bool_cast.png?alt=media" alt=""><figcaption><p>The available nodes to cast a Boolean to another data type</p></figcaption></figure>

**Inputs:**

<table><thead><tr><th width="162">Name</th><th width="168">Type</th><th>Description</th></tr></thead><tbody><tr><td>Input</td><td>Boolean</td><td>The value to be converted.</td></tr><tr><td>True Value</td><td>&#x3C;varies> [editable]</td><td>The value to output if the input is true.</td></tr><tr><td>False Value</td><td>&#x3C;varies> [editable]</td><td>The value to output if the input is false.</td></tr></tbody></table>

**Outputs:**

<table><thead><tr><th width="163">Name</th><th width="169">Type</th><th>Description</th></tr></thead><tbody><tr><td>Output</td><td>&#x3C;varies></td><td>The converted value.<br><br>The output depends on the chosen node, and is either a float, an integer, or a string.</td></tr></tbody></table>

## Boolean logic nodes

Perform Boolean logic operations on the provided inputs. All inputs and outputs are Boolean values.

<figure><img src="https://2640392766-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5yxYHsXtlAaoMUrDWhLm%2Fuploads%2Fgit-blob-71bccd565315ef57d0952a9f203b4068fc0a3e3d%2Fafx_node_bool_logic.png?alt=media" alt=""><figcaption><p>The available Boolean logic nodes</p></figcaption></figure>

<table><thead><tr><th width="202">Name</th><th>Operation</th></tr></thead><tbody><tr><td>Bool And</td><td>Output is <code>true</code> if both A <strong>and</strong> B are <code>true</code>.</td></tr><tr><td>Bool Or</td><td>Output is <code>true</code> if either A <strong>or</strong> B are <code>true</code>.</td></tr></tbody></table>

{% hint style="info" %}
If you need a node that's equivalent to a Not logical operation, see [#invert-bool](#invert-bool "mention").
{% endhint %}

## Logic Bool Changed

Outputs `true` in the frame where the input value changes from `true` to `false` or from `false` to `true`.

<figure><img src="https://2640392766-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5yxYHsXtlAaoMUrDWhLm%2Fuploads%2Fgit-blob-7cfd582160dac5622f0a60d4e44fa345ce52850e%2Fafx_node_logic_bool_changed.png?alt=media" alt=""><figcaption><p>Logic Bool Changed node</p></figcaption></figure>

**Inputs:**

<table><thead><tr><th width="152">Name</th><th width="160">Type</th><th>Description</th></tr></thead><tbody><tr><td>Input</td><td>Boolean</td><td>The Boolean value to monitor.</td></tr></tbody></table>

**Outputs:**

<table><thead><tr><th width="155">Name</th><th width="159">Type</th><th>Description</th></tr></thead><tbody><tr><td>Output</td><td>Boolean</td><td>True when the <code>Input</code> changes, but resets to false at the end of the frame.</td></tr></tbody></table>

### Example

In the following example, the referenced float is incremented by one each time that the referenced Boolean changes.

<figure><img src="https://2640392766-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5yxYHsXtlAaoMUrDWhLm%2Fuploads%2Fgit-blob-74906234611cc12c5e3da59ddba361b77324ed38%2Fafx_bool_changed_example.png?alt=media" alt=""><figcaption><p>Example graph to increment a float each time that a Boolean changes</p></figcaption></figure>

## Bool Constant

Outputs a true or false Boolean value. An AFX graph cannot change the value of this node.

{% hint style="info" %}
You can open an AFX graph to change the value of this node in the Unity Editor.
{% endhint %}

**Outputs:**

<table><thead><tr><th width="153">Name</th><th width="172">Type</th><th>Description</th></tr></thead><tbody><tr><td>Output</td><td>Boolean [editable]</td><td>A true or false value.</td></tr></tbody></table>

## Get Bool

Converts a reference to a Boolean component to a Boolean value.

**Inputs:**

<table><thead><tr><th width="175">Name</th><th width="166">Type</th><th>Description</th></tr></thead><tbody><tr><td>Bool Component</td><td>Bool Component</td><td>Reference to a Boolean component.</td></tr></tbody></table>

**Outputs:**

<table><thead><tr><th width="176">Name</th><th width="156">Type</th><th>Description</th></tr></thead><tbody><tr><td>Bool Out</td><td>Boolean</td><td>The true or false value of the Boolean component.</td></tr></tbody></table>

## Invert Bool

Inverts a Boolean value. If the input is `true`, the output is `false`. If the input is `false`, the output is `true`.

**Inputs:**

<table><thead><tr><th width="159">Name</th><th width="156">Type</th><th>Description</th></tr></thead><tbody><tr><td>Input</td><td>Boolean</td><td>The value to be inverted.</td></tr></tbody></table>

**Outputs:**

<table><thead><tr><th width="159">Name</th><th width="156">Type</th><th>Description</th></tr></thead><tbody><tr><td>Output</td><td>Boolean</td><td>The inverted value of the <code>Input</code>.</td></tr></tbody></table>

## Set Bool

Sets the value of a Boolean component.

**Inputs:**

<table><thead><tr><th width="171">Name</th><th width="182">Type</th><th>Description</th></tr></thead><tbody><tr><td>Enter</td><td>Flow</td><td>Flow to activate the node.</td></tr><tr><td>Bool Component</td><td>Boolean component</td><td>Reference to the Boolean component for which you want to set the value.</td></tr><tr><td>Value In</td><td>Boolean [editable]</td><td>The value that the Boolean component will be set to.</td></tr></tbody></table>

**Outputs:**

<table><thead><tr><th width="171">Name</th><th width="183">Type</th><th>Description</th></tr></thead><tbody><tr><td>Exit</td><td>Flow</td><td>Continue the activating flow.</td></tr><tr><td>Output</td><td>Boolean</td><td>Repeats the <code>Value In</code> value as an output.</td></tr></tbody></table>
