# For Each Unit In Unit Group
Grammar — For each unit var in group do (Actions)
Flags —SubFunctions
|Action
Runs the contained actions once for each unit in the unit group.
# Arguments
anyvariable
— Unitunitgroup
— Unit Group
Returns — void
#AUTOVAR(g, unitgroup) = #PARAM(group);
#AUTOVAR(u) = UnitGroupCount(#AUTOVAR(g), c_unitCountAll);
for (;; #AUTOVAR(u) -= 1) {
#PARAM(var) = UnitGroupUnitFromEnd(#AUTOVAR(g), #AUTOVAR(u));
if (#PARAM(var) == null) { break; }
#SUBFUNCS(actions)
}
# Related
Category: Unit Group / Loops
- Pick Each Unit In Unit Group — macro
- Pick Each Unit In Unit Group Deprecated — macro
- For Each Unit In Unit Group — macro
- For Each Unit In Unit Group Deprecated — macro
- Picked Unit
- Picked Unit Deprecated —
unit
— UnitGroupLoopCurrentDeprecated
# Examples
— None found —