a - b: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
mNo edit summary
m (moved to template)
Line 1: Line 1:
<h2 style="color:#000066">''' ''a'' - ''b'' '''</h2>
{{Command|= Comments
____________________________________________________________________________________________


| ofp |= Game name


'''Operand types:'''
|1.00|= Game version
____________________________________________________________________________________________


'''a:''' [[Number]] or [[Array]]
| For numbers: '''a''' minus '''b'''.  |= Description
____________________________________________________________________________________________


'''b:''' [[Number]] or [[Array]]
| ''' ''a'' - ''b'' ''' |= Syntax


'''Type of returned value:'''


[[Number]] or [[Array]]
|p1 = a: [[Number]] or [[Array]]


'''Description:'''
|p2 = b: [[Number]] or [[Array]]


For numbers: '''a''' minus '''b'''.
| [[Number]] or [[Array]]  |= Return value
____________________________________________________________________________________________
|x1 = <code>[[Number]]<br>_sum <nowiki>=</nowiki> 10 '''-''' 7 </code>
Result: _sum is 3


For arrays: Contents of array '''b''' removed from array '''a'''.<br>
|x2 = <code> For arrays: Contents of array '''b''' removed from array '''a'''.<br>[[Array]]<br>_result <nowiki>=</nowiki> [1,2,2,[[player]],"String"] '''-''' [2,[[player]],[[player]],"String"] </code>
'''See also.''' [[Array]]
_result is [1]
| [[Array]] |= See also


}}


'''Examples:'''
<h3 style="display:none">Notes</h3>
<dl class="command_description">
<!-- Note Section BEGIN -->


[[Number]]<br>_sum = 10 '''-''' 7 ............ _sum is 3
Note that this way of removing elements from an array will not work if those elements are themselves arrays.
 
Example:
 
[[0,0,0],[1,1,1],[2,2,2] ] - [1,1,1]


Will not remove the element [1,1,1] from the first array.


[[Array]]<br>_result = [1,2,2,[[player]],"String"] '''-''' [2,[[player]],[[player]],"String"] ............ _result is [1]
A more practical example:
[ [[getPos]] unit1, [[getPos]] unit2, [[getPos]] unit3] - [[getPos]] unit3


Will not remove the position of unit3 from the first array.


'''Comments:'''


Note that this way of removing elements from an array will not work if those elements are themselves arrays.
<!-- Note Section END -->
</dl>


For example:
<h3 style="display:none">Bottom Section</h3>


[[0,0,0],[1,1,1],[2,2,2] ] - [1,1,1]


Will not remove the element [1,1,1] from the first array.


A more practical example: [ [[getPos]] unit1, [[getPos]] unit2, [[getPos]] unit3] - [[getPos]] unit3<br>


Will not remove the position of unit3 from the first array.


[[Category:Scripting Commands|#]]
[[Category:Scripting Commands|#]]

Revision as of 15:41, 14 August 2006

Hover & click on the images for description

Description

Description:
For numbers: a minus b.
Groups:
Uncategorised

Syntax

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

Examples

Example 1:
Number
_sum = 10 - 7
Result: _sum is 3
Example 2:
For arrays: Contents of array b removed from array a.
Array
_result = [1,2,2,player,"String"] - [2,player,player,"String"]
_result is [1]

Additional Information

See also:
Array

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

Note that this way of removing elements from an array will not work if those elements are themselves arrays. Example: [[0,0,0],[1,1,1],[2,2,2] ] - [1,1,1] Will not remove the element [1,1,1] from the first array. A more practical example: [ getPos unit1, getPos unit2, getPos unit3] - getPos unit3 Will not remove the position of unit3 from the first array.

Bottom Section