---
name: "assert"
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/assert
revid: 363603
updated: 2024-04-08T09:49:06Z
---

# assert

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

## Description

Tests a condition and if the condition is false, displays error on screen (if -showscripterrors enabled) and logs error into .rpt file. It does not interrupt the script execution.

If script was pre-processed with [preprocessFileLineNumbers](../commands/preprocessFileLineNumbers.md), it will also show/log the error line number and the file name.

## Syntax

```sqf
assert condition
```

**Parameters:**

- `condition`: [Boolean](../topics/Boolean.md)

**Returns:** [Boolean](../topics/Boolean.md) - mirrors condition

## Examples

### Example 1

```sqf
assert (1 > 2);
```

### Example 2

Check function params (Faster alternative to [BIS_fnc_param](../functions/BIS_fnc_param.md))

```sqf
some_func = {
    _0 = _this select 0;
    _1 = _this select 1;
    _2 = _this select 2;
    if (!assert (
        typeName _0 == "ARRAY" && 
        typeName _1 == "STRING" &&
        typeName _2 == "SCALAR"
    )) exitWith { /* optional error logging */ };
    hint "Alright!";
};
[1,2,3] call some_func; // assert error
[[1],"2",3] call some_func; // Alright!
```

## See also

[try](../commands/try.md) · [catch](../commands/catch.md) · [throw](../commands/throw.md) · [halt](../commands/halt.md) · [diag_captureFrame](../commands/diag_captureFrame.md) · [diag_captureSlowFrame](../commands/diag_captureSlowFrame.md) · diag logSlowFrame

## Community notes

**RoehrenRadio** — 2010-05-15

Returns false, if condition is false, and returns true, if condition is true.

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