---
name: "throw"
type: command
status: ok
groups: ["Program Flow"]
arma3_since: "0.50"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/throw
revid: 377911
updated: 2026-01-07T16:33:15Z
---

# throw

*Command · Program Flow · Arma 3 v0.50 · introduced in Armed Assault v1.00*

## Description

Throws an exception. The exception is processed by first [catch](../commands/catch.md) block. This command will terminate further execution of the code.

> [!IMPORTANT]
> Avoid using alternative shorthand syntax if you are planning on preparing your exception information dynamically, as it will have to be generated first regardless of the condition of the [if](../commands/if.md) statement before it, as shown in [#Example 3](../commands/throw.md#example-3).

## Syntax

### Syntax 1

```sqf
throw exception
```

**Parameters:**

- `exception`: [Anything](../topics/Anything.md) - value that is put into the `_exception` variable inside [catch](../commands/catch.md) block

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

### Syntax 2

*since arma3 1.54*

```sqf
ifType throw exception
```

**Parameters:**

- `ifType`: [If Type](../topics/If_Type.md) - if the condition returns [true](../commands/true.md), *exception* is thrown
- `exception`: [Anything](../topics/Anything.md) - value that is put into the `_exception` variable inside [catch](../commands/catch.md) block

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

## Examples

### Example 1

```sqf
try { throw "invalid argument" } catch { hint str _exception };
```

### Example 2

```sqf
123 try { if (_this != 123) throw "invalid argument" } catch { hint str _exception };
```

### Example 3

The correct usage of shorthand alt syntax:

```sqf
try
{
    if (a > b)
        throw "Error: some error";                // OK - the command argument is static
}
catch
{
    hint str _exception;
};
```

```sqf
try
{
    if (a > b)
        throw (call _someFunc);                    // NOT OK - the command argument is dynamic
        // _someFunc is called first to get the value regardless of (a > b) outcome
}
catch
{
    hint str _exception;
};
```

```sqf
try
{
    if (a > b) then { throw (call _someFunc) };    // OK - the command argument is dynamic
    // _someFunc is only called when (a > b) is true
}
catch
{
    hint str _exception;
};
```

## See also

Exception handling · [try](../commands/try.md) · [catch](../commands/catch.md)

<sub>Source: [BI Community Wiki — throw](https://community.bistudio.com/wiki/throw) (revision 377911).</sub>
