while: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (fixed format bug)
m (fixed example)
Line 17: Line 17:
____________________________________________________________________________________________
____________________________________________________________________________________________
   
   
||x1= <pre>while {x<10} [[do]] {x<nowiki>=</nowiki>x+1} </pre>|= Example 1
||x1= <code>while {x<10} [[do]] {x<nowiki>=</nowiki>x+1} </code>|= Example 1


||x2=A more practical example: To repair all the members of a group to such a level that they are all able to stand up: <pre>{while {[[not]] [[canStand]] _x} [[do]] {_x [[setDammage]] ([[getDammage]] _x) - 0.01}}[[forEach]] units [[group]] unitname </pre> |= Example 2
||x2=A more practical example: To repair all the members of a group to such a level that they are all able to stand up: <code><nowiki>{</nowiki>while <nowiki>{</nowiki>[[not]] [[canStand]] _x<nowiki>}</nowiki> [[do]] <nowiki>{</nowiki>_x [[setDammage]] ([[getDammage]] _x) - 0.01<nowiki>}}</nowiki>[[forEach]] units [[group]] unitname </code> |= Example 2
____________________________________________________________________________________________
____________________________________________________________________________________________
|  |= See also
|  |= See also

Revision as of 23:58, 3 August 2006

Hover & click on the images for description

Description

Description:
First part of while construct.
Groups:
Uncategorised

Syntax

Syntax:
while condition
Parameters:
condition: String
Return Value:
While Type

Examples

Example 1:
while {x<10} do {x=x+1}
Example 2:
A more practical example: To repair all the members of a group to such a level that they are all able to stand up: {while {not canStand _x} do {_x setDammage (getDammage _x) - 0.01}}forEach units group unitname

Additional Information

See also:
See also needed

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