# control_flow

URL: /kida/api/nodes/control_flow/
Section: nodes
Description: Control flow nodes for Kida AST.

---

> For a complete page index, fetch /kida/llms.txt.

Open LLM text
(/kida/api/nodes/control_flow/index.txt)

Share with AI

Ask Claude
(https://claude.ai/new?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fkida%2Fapi%2Fnodes%2Fcontrol_flow%2Findex.txt)

Ask ChatGPT
(https://chatgpt.com/?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fkida%2Fapi%2Fnodes%2Fcontrol_flow%2Findex.txt)

Ask Gemini
(https://gemini.google.com/app?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fkida%2Fapi%2Fnodes%2Fcontrol_flow%2Findex.txt)

Ask Copilot
(https://copilot.microsoft.com/?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fkida%2Fapi%2Fnodes%2Fcontrol_flow%2Findex.txt)

Module

#
`nodes.control_flow`

Control flow nodes for Kida AST.

8Classes

## Classes

`If`

4

▼

Conditional: {% if cond %}...{% elif cond %}...{% else %}...{% end %}

Conditional: {% if cond %}...{% elif cond %}...{% else %}...{% end %}

#### Attributes

Name
Type
Description

`test`

`Expr`

—

`body`

`Sequence[Node]`

—

`elif_`

`Sequence[tuple[Expr, Sequence[Node]]]`

—

`else_`

`Sequence[Node]`

—

`For`

6

▼

For loop: {% for x in items %}...{% empty %}...{% end %}

For loop: {% for x in items %}...{% empty %}...{% end %}

#### Attributes

Name
Type
Description

`target`

`Expr`

—

`iter`

`Expr`

—

`body`

`Sequence[Node]`

—

`empty`

`Sequence[Node]`

—

`recursive`

`bool`

—

`test`

`Expr | None`

—

`AsyncFor`

5

▼

Async for loop: {% async for x in async_items %}...{% end %}

Async for loop: {% async for x in async_items %}...{% end %}

#### Attributes

Name
Type
Description

`target`

`Expr`

—

`iter`

`Expr`

—

`body`

`Sequence[Node]`

—

`empty`

`Sequence[Node]`

—

`test`

`Expr | None`

—

`While`

2

▼

While loop: {% while cond %}...{% end %}

While loop: {% while cond %}...{% end %}

#### Attributes

Name
Type
Description

`test`

`Expr`

—

`body`

`Sequence[Node]`

—

`Match`

2

▼

Pattern matching: {% match expr %}{% case pattern [if guard] %}...{% end %}

Pattern matching: {% match expr %}{% case pattern [if guard] %}...{% end %}

#### Attributes

Name
Type
Description

`subject`

`Expr | None`

—

`cases`

`Sequence[tuple[Expr, Expr | None, Sequence[Node]]]`

—

`Break`

0

▼

Break out of loop: {% break %}

Break out of loop: {% break %}

`Continue`

0

▼

Skip to next iteration: {% continue %}

Skip to next iteration: {% continue %}

`Try`

3

▼

Error boundary: {% try %}...{% fallback [error] %}...{% end %}

Catches rendering errors in body an…

Error boundary: {% try %}...{% fallback [error] %}...{% end %}

Catches rendering errors in body and renders fallback content instead.
If error_name is set, the caught exception is bound as a dict in the
fallback scope with keys: message, type, template, line.

#### Attributes

Name
Type
Description

`body`

`Sequence[Node]`

—

`fallback`

`Sequence[Node]`

—

`error_name`

`str | None`

—
