> For the complete documentation index, see [llms.txt](https://horizongames.gitbook.io/actorio/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://horizongames.gitbook.io/actorio/logic-actors/logic-branch.md).

# Logic Branch

<div align="left"><figure><img src="/files/Z3J40a2dJbO1LzsjQLKa" alt=""><figcaption></figcaption></figure></div>

An actor that tests a boolean value and fires the appropriate true or false output event. Use this to branch between two potential outcomes.

| Events  | Description                                                         | Named Arguments         |
| ------- | ------------------------------------------------------------------- | ----------------------- |
| OnTrue  | Event when the stored boolean value is true when 'Test' is called.  | `$Value`: Current value |
| OnFalse | Event when the stored boolean value is false when 'Test' is called. | `$Value`: Current value |

| Functions       | Description                                                                                          | Parameters     |
| --------------- | ---------------------------------------------------------------------------------------------------- | -------------- |
| SetValue        | Set the boolean value without performing the comparison. Use this to hold a value for a future test. | <`bool` Value> |
| SetValueAndTest | Set the boolean value and test it, firing 'OnTrue' or 'OnFalse' based on the new value.              | <`bool` Value> |
| Toggle          | Toggle the boolean value between true and false without performing the comparison.                   | -              |
| ToggleAndTest   | Toggle the boolean value and test it, firing 'OnTrue' or 'OnFalse' based on the new value.           | -              |
| Test            | Test the boolean value and fire 'OnTrue' or 'OnFalse' based on the value.                            | -              |

| SaveGame Properties    | Description                  |
| ---------------------- | ---------------------------- |
| bCurrentValue (`bool`) | Current value of the branch. |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://horizongames.gitbook.io/actorio/logic-actors/logic-branch.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
