for var: Difference between revisions
Jump to navigation
Jump to search
Killzone Kid (talk | contribs) (fixed) |
No edit summary |
||
Line 49: | Line 49: | ||
Variable name doesn't have to start with _. could be:<code>[[for]] "LAlala" [[from]] 0 [[to]] 0 [[do]] {[[hint]] [[str]] LAlala}; //0</code> | Variable name doesn't have to start with _. could be:<code>[[for]] "LAlala" [[from]] 0 [[to]] 0 [[do]] {[[hint]] [[str]] LAlala}; //0</code> | ||
The variable ''LAlala'' will exist only inside [[do]] {} scope and will not overwrite any variable of the same name that existed before. | The variable ''LAlala'' will exist only inside [[do]] {} scope and will not overwrite any variable of the same name that existed before. | ||
</dd> | |||
</dl> | |||
<!-- DISCONTINUE Notes --> | |||
<!-- CONTINUE Notes --> | |||
<dl class="command_description"> | |||
<dd class="notedate">Posted on January 29, 2016 - 05:18 (UTC)</dd> | |||
<dt class="note">[[User:DreadedEntity|DreadedEntity]]</dt> | |||
<dd class="note"> | |||
For loops can be safely nested. This means that there should not be any problems with recursion. | |||
<code>_array = []; | |||
[[for]] "_i" from 0 to 3 do | |||
{ | |||
[[for]] "_i" from 0 to 3 do | |||
{ | |||
_array [[pushBack]] _i; | |||
}; | |||
_array [[pushBack]] _i; | |||
}; | |||
[[hint]] [[str]] _array;</code> | |||
</dd> | </dd> | ||
</dl> | </dl> | ||
<!-- DISCONTINUE Notes --> | <!-- DISCONTINUE Notes --> |
Revision as of 06:18, 29 January 2016
Description
- Description:
- Starts for sequence, use in complete form (see example). The default step increment is 1. An optional step increment can be specified using the extended syntax.
- Groups:
- Uncategorised
Syntax
Examples
- Example 1:
for "_i" from 1 to 10 do {debugLog _i;};
- Example 2:
for "_i" from 9 to 1 step -2 do {debugLog _i;};
Additional Information
- See also:
- for [ ]for doControl 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 29 April 2010 (CEST)
- alef
for "_i" from 0 to 0 do {}; //will do once, with _i = 0 for "_i" from 0 to -1 do {}; //will not do