forEach: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
<h2 style="color:#000066">''command '''''forEach ''array'''''</h2>
back to [[Scripting_Reference#F|COMREF]]
 
<h2 style="color:#000066">'''''command'' forEach ''array'''''</h2>
 


'''Operand types:'''
'''Operand types:'''


command: [[String]]
'''command:''' [[String]]


array: [[Array]]
'''array:''' [[Array]]


'''Type of returned value:'''
'''Type of returned value:'''


Nothing
[[Nothing]]


'''Description:'''
'''Description:'''


Execute given command for each element of array.
Execute given '''command''' for each element of '''array'''.


It is executed as follows:
It is executed as follows:


For each element of array assign element as _x and execute command.
For each element of '''array''' assign element as '''_x''' and execute '''command'''.
 


'''Example:'''
'''Example:'''


"_x setdammage 1" '''forEach''' units group player
"_x [[setdammage]] 1" '''forEach''' [[units]] [[group]] [[player]]

Revision as of 10:39, 16 April 2006

back to COMREF

command forEach array


Operand types:

command: String

array: Array

Type of returned value:

Nothing

Description:

Execute given command for each element of array.

It is executed as follows:

For each element of array assign element as _x and execute command.


Example:

"_x setdammage 1" forEach units group player