Arma 3 Scripting

Command in Math, Arrays

-

Also available as Markdown and JSON, or read the original wiki page.

Description

Subtracts numbers or arrays from each another, negates a number. For arrays also see deleteAt and deleteRange.

Note

Arma 3: In Arma 3 it is possible to subtract nested arrays.

Syntax

Syntax 1

numberA - numberB

Parameters:

Returns: Number

Syntax 2

- numberA

Parameters:

Returns: Number - the negative of numberA

Syntax 3

arrayA - arrayB

Parameters:

Returns: Array of Anything

Examples

Example 1

_result = 10 - 7; // result is 3

Example 2

_numA = 4;
_numB = -_numA; // result is -4
_numB = -_numB; // result is  4

Example 3

_result = [1, 2, 2, player, "String"] - [2, player, player, "String"]; // _result is [1]

Example 4

_result = [0, [0], [[0]]] - [0]; // [[0], [[0]]]

Example 5

_result = [0, [0], [[0]]] - [[0]];        // [0, [[0]]]    - Since Arma 3
_result = [0, [0], [[0]]] - [[[0]]];    // [0, [0]]        - Since Arma 3

See also

Array · Operators · deleteAt · deleteRange