while: Difference between revisions
Jump to navigation
Jump to search
m (the limitation doesn't apply anymore) |
m (moved do blurb into here) |
||
Line 7: | Line 7: | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| | | Repeat '''[[Code]]''' while condition is [[true]]. |= Description | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| '''while ''condition | | '''while''' {condition} [[do]] {[[Code]]} |= Syntax | ||
|p1= condition: [[Code]] |= | |p1= condition : [[Boolean]] [[Code]] | ||
|p2 =[[Code]] | |||
| [[ | |||
| [[Nothing]] |= Return value | |||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
|x1= <code>while { | |x1= <code>[[while]] {a>b} '''[[do]]''' {a<nowiki>=</nowiki>a+1} </code> | ||
|x2=A practical example: Repair all members of a group to such a level that they are able to stand up: <code><nowiki>{</nowiki><br> while <nowiki>{</nowiki>([[not]] [[canStand]] _x) [[and]] ([[alive]] _x)<nowiki>}</nowiki> [[do]] <nowiki>{</nowiki><br> _x [[setDammage]] ([[getDammage]] _x) - 0.01;<br> <nowiki>};</nowiki><br><nowiki>}</nowiki> [[forEach]] units [[group]] unitname; </code> |= Example 2____________________________________________________________ | |x2=A practical example: Repair all members of a group to such a level that they are able to stand up: <code><nowiki>{</nowiki><br> while <nowiki>{</nowiki>([[not]] [[canStand]] _x) [[and]] ([[alive]] _x)<nowiki>}</nowiki> [[do]] <nowiki>{</nowiki><br> _x [[setDammage]] ([[getDammage]] _x) - 0.01;<br> <nowiki>};</nowiki><br><nowiki>}</nowiki> [[forEach]] units [[group]] unitname; </code> |= Example 2____________________________________________________________ | ||
Revision as of 06:03, 5 September 2007
Description
- Description:
- Repeat Code while condition is true.
- Groups:
- Uncategorised
Syntax
Examples
- Example 1:
while {a>b} do {a=a+1}
- Example 2:
- A practical example: Repair all members of a group to such a level that they are able to stand up:
{
while {(not canStand _x) and (alive _x)} do {
_x setDammage (getDammage _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
Categories:
- Scripting Commands
- Introduced with Operation Flashpoint: Resistance version 1.85
- Operation Flashpoint: Resistance: New Scripting Commands
- Operation Flashpoint: Resistance: Scripting Commands
- Command Group: Uncategorised
- Scripting Commands OFP 1.96
- Scripting Commands ArmA
- ArmA: Control Structures
- Command Group: Program Flow