do: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "_{10,} " to "")
m (Text replacement - " *\| *([Cc]omments|COMMENTS|Game|[Gg]ame [Nn]ame|Game [Vv]ersion|Game Version \(number surrounded by NO SPACES\)|Multiplayer Arguments( \("local" or "global"\))?|Effects|Multiplayer Effects( \("local" or "global"\))?|Multiplayer Exe...)
Line 1: Line 1:
{{Command|Comments=
{{Command


| ofpr |Game name=
| ofpr


|gr1= Program Flow |GROUP1=
|gr1= Program Flow






|1.85|Game version=
|1.85


| Executes ''code''. Used as part of a construct, such as [[while]], [[with]], [[for]] and [[switch]]. The ''code'' is always executed in [[missionNamespace]] unless [[do]] is used with [[with]] as an argument. |DESCRIPTION=
| Executes ''code''. Used as part of a construct, such as [[while]], [[with]], [[for]] and [[switch]]. The ''code'' is always executed in [[missionNamespace]] unless [[do]] is used with [[with]] as an argument.


| construct [[do]] code |SYNTAX=
| construct [[do]] code


|p1= construct: One of:
|p1= construct: One of:
Line 17: Line 17:
* [[With Type]] ([[with]])
* [[With Type]] ([[with]])
* [[For Type]] ([[for]])
* [[For Type]] ([[for]])
* [[Switch Type]] ([[switch]]) |PARAMETER1=
* [[Switch Type]] ([[switch]])


|p2= code: [[Code]] |PARAMETER2=
|p2= code: [[Code]]


| [[Anything]] |RETURNVALUE=
| [[Anything]]


|x1= <code>[[while]] { b > a } [[do]] { a = a + 1 };</code> |EXAMPLE1=
|x1= <code>[[while]] { b > a } [[do]] { a = a + 1 };</code>


|x2= Repair all members of a group to such a level that they are able to stand up:
|x2= Repair all members of a group to such a level that they are able to stand up:
Line 30: Line 30:
[[Magic Variables|_x]] [[setDamage]] ([[damage]] [[_x]] - 0.01);
[[Magic Variables|_x]] [[setDamage]] ([[damage]] [[_x]] - 0.01);
};
};
} [[forEach]] [[units]] [[group]] unitname;</code> |EXAMPLE2=
} [[forEach]] [[units]] [[group]] unitname;</code>


| [[Control Structures]] |SEEALSO=
| [[Control Structures]]
}}
}}



Revision as of 00:27, 18 January 2021

Hover & click on the images for description

Description

Description:
Executes code. Used as part of a construct, such as while, with, for and switch. The code is always executed in missionNamespace unless do is used with with as an argument.
Groups:
Program Flow

Syntax

Syntax:
construct do code
Parameters:
construct: One of:
code: Code
Return Value:
Anything

Examples

Example 1:
while { b > a } do { a = a + 1 };
Example 2:
Repair all members of a group to such a level that they are able to stand up: { while {!canStand _x && alive _x} do { _x setDamage (damage _x - 0.01); }; } forEach units group unitname;

Additional Information

See also:
Control Structures

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