while

From Bohemia Interactive Community
Revision as of 18:01, 2 May 2007 by Manny (talk | contribs)
Jump to navigation Jump to search
Hover & click on the images for description

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