for var: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
(Redirect to for)
 
Line 1: Line 1:
{{Command|= Comments
#REDIRECT [[for]]
____________________________________________________________________________________________
 
| arma |= Game name
 
|1.00|= Game version
____________________________________________________________________________________________
 
|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.|= Description
____________________________________________________________________________________________
 
| '''for''' variable |= Syntax
 
|p1= variable: [[String]]|= Parameter 1
 
| [[For Type]] |= Return value
____________________________________________________________________________________________
 
|x1= <code>[[for]] "_i" [[from]] 1 [[to]] 10 [[do]] {[[debugLog]] _i;};</code> |= Example 1
|x2= <code>[[for]] "_i" [[from]] 9 [[to]] 1 [[step]] -2 [[do]] {[[debugLog]] _i;};</code> |= Example 2
____________________________________________________________________________________________
 
| [[for forspec|for [ ]]], [[for_do|for do]], [[Control Structures]] |= See also
 
}}
 
<h3 style="display:none">Notes</h3>
<dl class="command_description">
<!-- Note Section BEGIN -->
 
<dd class="notedate">Posted on 29 April 2010 (CEST)
<dt class="note">'''[[User:Alef|alef]]'''<dd class="note"><code>[[for]] "_i" [[from]] 0 [[to]] 0 [[do]] {}; //will do once, with _i = 0
[[for]] "_i" [[from]] 0 [[to]] -1 [[do]] {}; //will not do
</code>
<!-- Note Section END -->
</dl>
 
<h3 style="display:none">Bottom Section</h3>
[[Category:Scripting Commands|FORB]]
[[Category:Scripting Commands ArmA|FORB]]
[[Category:Command Group: Program Flow|FORB]]
 
<!-- CONTINUE Notes -->
<dl class="command_description">
<dd class="notedate">Posted on June 4, 2015 - 19:27 (UTC)</dd>
<dt class="note">[[User:Killzone Kid|Killzone Kid]]</dt>
<dd class="note">
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.
</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>
</dl>
<!-- DISCONTINUE Notes -->

Latest revision as of 22:15, 4 February 2019

Redirect to: