<div class='type'>Function</div>


<a id='references'></a>


<h2 id="traversedescendants-key-block">traverseDescendants</h2>

<div class='sourceset sourceset-common'>Common</div>


```kotlin
fun DelegatableNode.traverseDescendants(
    key: Any?,
    block: (TraversableNode) -> TraverseDescendantsAction,
)
```


Conditionally executes `block` for each descendant with a matching `key`.

Note 1: For nodes that do not have the same key, it will continue to execute the `block` for
descendants below that non-matching node (where there may be a node that matches).

Note 2: The parameter `block`'s return value `TraverseDescendantsAction` will determine the next
step in the traversal.





<hr class="docs-overload-divider">


<h2 id="traversedescendants-block-t">traverseDescendants</h2>

<div class='sourceset sourceset-common'>Common</div>


```kotlin
fun <T> T.traverseDescendants(block: (T) -> TraverseDescendantsAction) where T : TraversableNode
```


Conditionally executes `block` for each descendant of the same class.

Note 1: For nodes that do not have the same key, it will continue to execute the `block` for the
descendants below that non-matching node (where there may be a node that matches).

Note 2: The parameter `block`'s return value `TraverseDescendantsAction` will determine the next
step in the traversal.