while: Difference between revisions
Jump to navigation
Jump to search
m (fixed formatting) |
No edit summary |
||
Line 28: | Line 28: | ||
<dl class="command_description"> | <dl class="command_description"> | ||
<!-- Note Section BEGIN --> | <!-- Note Section BEGIN --> | ||
<dd class="notedate">Posted on 02 May, 2007</dd> | |||
<dt class="note">'''[[User:Manny|Manny]]'''</dt><dd class="note"> | |||
While-loops will not run forever. In fact, after 10.000 cycles it will simply stop. If you '''really need''' an endless loop, try using a [[Control_Structures#for-Loop|for-loop]] without step incrementation. Example: | |||
<code><nowiki>for [{ }, { true }, { }] do { /* ..something.. */ };</nowiki></code> | |||
</dd> | |||
<!-- Note Section END --> | <!-- Note Section END --> | ||
</dl> | </dl> |
Revision as of 18:01, 2 May 2007
Description
- Description:
- First part of while construct.
- Groups:
- Uncategorised
Syntax
- Syntax:
- while condition
- Parameters:
- condition: Code
- Return Value:
- While Type
Examples
- Example 1:
while {x<10} do {x=x+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
- Posted on 02 May, 2007
- Manny
-
While-loops will not run forever. In fact, after 10.000 cycles it will simply stop. If you really need an endless loop, try using a for-loop without step incrementation. Example:
for [{ }, { true }, { }] do { /* ..something.. */ };
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