---
name: "diag_scope"
type: command
status: ok
groups: ["Diagnostic", "Performance Profiling"]
arma3_since: "2.02"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/diag_scope
revid: 369074
updated: 2024-09-02T20:25:00Z
---

# diag_scope

*Command · Diagnostic, Performance Profiling · Arma 3 v2.02*

## Description

Returns script scope depth. When script is directly executed by the engine or a new script is added to the scheduler, the scope depth is 0.
The examples of such execution are event handlers, [spawn](../commands/spawn.md), etc. [isNil](../commands/isNil.md) [Code](../topics/Code.md) will also create a parent scope.
Any use of [call](../commands/call.md) and such will stack execution creating child scopes and increasing scope depth.

## Syntax

```sqf
diag_scope
```

**Returns:** [Number](../topics/Number.md)

## Examples

### Example 1

```sqf
0 spawn
{ 
    systemChat str diag_scope; // 0
    call 
    { 
        call
        { 
            systemChat str diag_scope; // 2
            isNil 
            { 
                systemChat str diag_scope; // 0
                call 
                {
                    systemChat str diag_scope; // 1
                };
            };
        };
    };
};
```

## See also

[exitWith](../commands/exitWith.md) · [diag_fps](../commands/diag_fps.md) · [diag_fpsMin](../commands/diag_fpsMin.md) · [diag_frameNo](../commands/diag_frameNo.md) · [diag_log](../commands/diag_log.md) · [diag_tickTime](../commands/diag_tickTime.md) · [diag_deltaTime](../commands/diag_deltaTime.md)

<sub>Source: [BI Community Wiki — diag scope](https://community.bistudio.com/wiki/diag_scope) (revision 369074).</sub>
