> For the complete documentation index, see [llms.txt](https://docs.r.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.r.xyz/glider-ide/api/instruction/instruction.next_instructions_recursive.md).

# Instruction.next\_instructions\_recursive()

Returns the set of all instructions following the current node in the control flow graph.

`next_instructions_recursive() →` [`APISet`](/glider-ide/api/iterables/apiset.md)`[`[`Instruction`](/glider-ide/api/instruction.md)`]`

The difference between the next\_instructions\_recursive() function and [next\_instructions()](/glider-ide/api/instruction/instruction.next_instructions.md) is that this function works in an recursive (**inter**-procedural) manner and returns all instructions following the current instruction in the CFG (control-flow-graph).

*The function is recursive (intra-procedural), and follows function calls; for the non-recursive (**intra**-procedural) variant of this function, use* [*`next_instructions()`*](/glider-ide/api/instruction/instruction.next_instructions.md)*.*

For example, in the function:

```solidity
function approve(address spender, uint256 amount) public override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }
```

for the instruction:

```solidity
_approve(_msgSender(), spender, amount);
```

the function will return instructions from `_approve()`.

### Query Example

```python
from glider import *
def query():

  instructions = Functions().with_name("approve").exec(1, 9).instructions().exec(1,1)
  
  return instructions + list(instructions.next_instructions_recursive())
```

### Output Example

<figure><img src="https://2237101709-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDX4Ojc4j1ef51TUAtYOx%2Fuploads%2FGgBu5p2ZqQHybd0uKqSC%2Fimage.png?alt=media&amp;token=76352d17-eb89-47dd-b7af-0bdfb3fce723" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2237101709-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDX4Ojc4j1ef51TUAtYOx%2Fuploads%2FJffhqEs2SUOXIRh5tViy%2Fimage.png?alt=media&amp;token=959a00c5-e5e4-4f96-8418-bf1509160d95" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2237101709-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDX4Ojc4j1ef51TUAtYOx%2Fuploads%2FIl0hWIT4NMC2Z76acQlS%2Fimage.png?alt=media&amp;token=86af42e0-2488-45f9-95a6-8e5bb9a818ed" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2237101709-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDX4Ojc4j1ef51TUAtYOx%2Fuploads%2F1iUDCS3no4mk3ikfLbxN%2Fimage.png?alt=media&amp;token=723fff66-bd39-4f56-8d3d-70d28ed7f68d" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2237101709-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDX4Ojc4j1ef51TUAtYOx%2Fuploads%2FXsZNeKkqnHHbcwoTirPq%2Fimage.png?alt=media&amp;token=cf0ddf63-7525-436f-92df-159136dead4e" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2237101709-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDX4Ojc4j1ef51TUAtYOx%2Fuploads%2FxoIbptjkMzXN24sGfpnR%2Fimage.png?alt=media&amp;token=ee6fbbb2-026c-4a10-ae6e-d8d02ba4fd5c" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2237101709-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDX4Ojc4j1ef51TUAtYOx%2Fuploads%2FYKPiFoZAj66OCByjjG1l%2Fimage.png?alt=media&amp;token=f06bfc78-4936-450a-bd28-ef6f134bdab7" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
The function returns APISet, instead of APIList, in case the result of the function is used as the return value of the query it must be casted to `list()`
{% endhint %}
