# Advanced Conditional

> Run different blocks based on grouped comparisons.

- ID: `advanced_conditional`
- Type: Condition
- Category: [Logic](https://inventor.bot/docs/reference/blocks/logic.md)

- Condition block: write `if advanced_conditional(Args{...}) { ... }`, or use it as a `"true"`/`"false"` value. See conditions.

**Inputs**

| Name | Required | Description | Value |
| --- | --- | --- | --- |
| `conditions` | yes | Conditions | JSON text, format below |
| `if_true` |  | Blocks to run when the conditions evaluate to true. | blocks: `func() { ... }` |
| `if_false` |  | Blocks to run when the conditions evaluate to false. | blocks: `func() { ... }` |

**`conditions` format**: JSON text of type `AdvancedConditionGroup`. Fields marked `?` are optional.

```ts
type AdvancedConditionGroup = {
	logic: string // "and" or "or"
	conditions: AdvancedConditionItem[]
}

type AdvancedConditionItem = {
	type: string // "comparison" or "group"
	left?: string // comparison only
	operator?: string // comparison only: any if_statement condition, e.g. "equals (=)" or "contains (case insensitive)"
	right?: string // comparison only
	group?: AdvancedConditionGroup // group only
}
```

**Outputs**

| Name | Description | Value |
| --- | --- | --- |
| `result` | Whether the conditions evaluated to true or false. | e.g. `"true"` |

**Example**

```go
if "a" == "a" {
	send_text_message(Args{channel_id: trigger.channel_id, message_content: "Yes"})
}
```