# IfChain


```
class IfChain : Node
```

<br />

|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) |||
| ↳ | [com.google.home.automation.Node](https://developers.home.google.com/reference/kotlin/com/google/home/automation/Node) ||
|   | ↳ | [com.google.home.automation.IfChain](https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfChain) |

*** ** * ** ***

An intermediary builder type used while building an `https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfFlow`.

`https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfChain` represents a conditional structure consisting of an initial `ifThen` clause and optional `https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfChain#elseIfThens()`. It does *not* include an `elseThen` clause. An `https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfChain` can be converted into a complete `https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfFlow` by adding an `orElse` clause via its extension function.

If the condition of the primary `ifThen` is true, its associated node is executed. Otherwise, the `https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfChain#elseIfThens()` are evaluated in order. If any `https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfThen` condition in `elseIfThens` is true, its associated node is executed, and subsequent conditions are skipped. If no condition is met, execution continues to the `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Node` following this `https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfChain` in the parent `https://developers.home.google.com/reference/kotlin/com/google/home/automation/SequentialFlow`.

## Summary

| ### Public constructors |
|---|
| `https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfChain#IfChain(com.google.home.automation.IfThen,kotlin.collections.List)(ifThen: https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfThen, elseIfThens: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html<https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfThen>)` Create an `IfChain` instance. |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html<https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfThen>` | `https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfChain#elseIfThens()` Subsequent conditional clauses in the `https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfChain`. |
| `https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfThen` | `https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfChain#ifThen()` The primary `https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfThen` in the `https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfChain`. |

### Inherited properties

From [com.google.home.automation.Node](https://developers.home.google.com/reference/kotlin/com/google/home/automation/Node) `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html?` `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Node#nodeId()`

String identifier of this node.

## Public constructors

### IfChain

```
IfChain(ifThen: IfThen, elseIfThens: List<IfThen> = emptyList())
```

Create an `IfChain` instance.

| Parameters |
|---|---|
| `ifThen: https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfThen` | The first `https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfThen` clause of the `https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfChain`. |
| `elseIfThens: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html<https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfThen> = emptyList()` | Subsequent conditional clauses in the `https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfChain`. |

## Public properties

### elseIfThens

```
val elseIfThens: List<IfThen>
```

Subsequent conditional clauses in the `https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfChain`. These will execute in order if the first `https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfThen` is false. If any `https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfThen` condition is true, its associated node is executed, and the rest of the conditions are not evaluated.

### ifThen

```
val ifThen: IfThen
```

The primary `https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfThen` in the `https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfChain`.