a - b: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(updated description.example, moved malformatted note to talk)
m (Added note that the command creates a new array)
Line 20: Line 20:
|x1 = For numbers: <code>_sum = 10 - 7; //_sum is 3</code>|=
|x1 = For numbers: <code>_sum = 10 - 7; //_sum is 3</code>|=


|x2 = For arrays: contents of array '''b''' removed from array '''a'''<code>_result = [1, 2, 2, [[player]], "String"] - [2, [[player]], [[player]], "String"]; //_result is [1]</code>|=
|x2 = For arrays: contents of array '''b''' removed from array '''a'''. Returns new array.<code>_result = [1, 2, 2, [[player]], "String"] - [2, [[player]], [[player]], "String"]; //_result is [1]</code>|=


|x3 = Compare:<code>[0,[0],<nowiki>[</nowiki>[0]]] - [0]; //<nowiki>[</nowiki>[0],<nowiki>[</nowiki>[0]]]  
|x3 = Compare:<code>[0,[0],<nowiki>[</nowiki>[0]]] - [0]; //<nowiki>[</nowiki>[0],<nowiki>[</nowiki>[0]]]  

Revision as of 02:01, 20 September 2017

Hover & click on the images for description

Description

Description:
Subtracts b from a. a and b need to be of the same type, both Numbers or both Arrays. In Arma 3 it is possible to subtract nested arrays.
Groups:
Uncategorised

Syntax

Syntax:
a - b
Parameters:
a: Number or Array
b: Number or Array
Return Value:
Number or Array

Examples

Example 1:
For numbers: _sum = 10 - 7; //_sum is 3
Example 2:
For arrays: contents of array b removed from array a. Returns new array._result = [1, 2, 2, player, "String"] - [2, player, player, "String"]; //_result is [1]
Example 3:
Compare:[0,[0],[[0]]] - [0]; //[[0],[[0]]] [0,[0],[[0]]] - [[0]]; //[0,[[0]]] - Arma 3 only [0,[0],[[0]]] - [[[0]]]; //[0,[0]] - Arma 3 only

Additional Information

See also:
ArrayOperators

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note

Notes

Bottom Section