# IfFlow


```
class IfFlow : 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.IfFlow](https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfFlow) |

*** ** * ** ***

A `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Node` that conditionally executes one of its branches based on evaluating conditions in order. This represents a complete if-elseif-else structure.

It operates similar to traditional if-elseif-else construct:

The node in `https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfFlow#ifThen()` is executed if its condition is true. If not, the conditions in `https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfFlow#elseIfThens()` are evaluated in order sequentially, and the node of the first `https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfThen` with a true condition is executed. If all conditions are false, the `https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfFlow#elseThen()` node is executed, if provided. If no condition is met and no `https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfFlow#elseThen()` is provided, then no `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Node` within this `https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfFlow` executes, and 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/IfFlow` in the parent `https://developers.home.google.com/reference/kotlin/com/google/home/automation/SequentialFlow`.

This class is the final representation of a conditional flow, often built using the `https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfChain` builder within the `https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfFlowDsl`.

## Summary

| ### Public constructors |
|---|
| `https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfFlow#IfFlow(com.google.home.automation.IfThen,kotlin.collections.List,com.google.home.automation.Node)(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>, elseThen: https://developers.home.google.com/reference/kotlin/com/google/home/automation/Node?)` Create an `IfFlow` 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/IfFlow#elseIfThens()` Optional subsequent conditional clauses in the `https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfFlow`. |
| `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Node?` | `https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfFlow#elseThen()` An optional else clause of the `https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfFlow`. |
| `https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfThen` | `https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfFlow#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/IfFlow`. |

### 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

### IfFlow

```
IfFlow(
    ifThen: IfThen,
    elseIfThens: List<IfThen> = emptyList(),
    elseThen: Node? = null
)
```

Create an `IfFlow` 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/IfFlow`. |
| `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()` | Optional subsequent conditional clauses in the `https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfFlow`. |
| `elseThen: https://developers.home.google.com/reference/kotlin/com/google/home/automation/Node? = null` | The else clause of the `https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfFlow` represented as an executable `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Node`. |

## Public properties

### elseIfThens

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

Optional subsequent conditional clauses in the `https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfFlow`. These will execute in order if the primary `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 defined in this list is true, its associated node is executed, and the rest of the conditions are not evaluated.

### elseThen

```
val elseThen: Node?
```

An optional else clause of the `https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfFlow`. If provided, this will execute if none of the previous `https://developers.home.google.com/reference/kotlin/com/google/home/automation/IfThen` clauses execute.

### 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/IfFlow`. This is the first condition that is evaluated.