for var: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(Fixed: script command FOR (BASIC) can use capital characters in variable)
m (formate)
Line 19: Line 19:
____________________________________________________________________________________________
____________________________________________________________________________________________


|x1= <code>'''for''' "_i" from 1 to 10 [[do]] {[[debugLog]] _i;};</code> |= Example 1
|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
|x2= <code>[[for]] "_i" [[from]] 9 [[to]] 1 [[step]] -2 [[do]] {[[debugLog]] _i;};</code> |= Example 2
____________________________________________________________________________________________
____________________________________________________________________________________________


Line 30: Line 30:
<dl class="command_description">
<dl class="command_description">
<!-- Note Section BEGIN -->
<!-- Note Section BEGIN -->
<dd class="notedate">Posted on 26 January 2007 (CET)
<dd class="notedate">Posted on 26 January 2007 (CET)
<dt class="note">'''[[User:T D|T_D]]'''
<dt class="note">'''[[User:T D|T_D]]'''
<dd class="note">Chosen variable may not contain capital letters.
<dd class="note">Chosen variable may not contain capital letters.
for "_I" from 0 to 4 do{}; //will not work
<code>[[for]] "_I" [[from]] 0 [[to]] 4 [[do]] {}; //will not work</code>


<dd class="notedate">Posted on 4 October 2011 (CET)
<dd class="notedate">Posted on 4 October 2011 (CET)
Line 42: Line 40:


<dd class="notedate">Posted on 29 April 2010 (CEST)
<dd class="notedate">Posted on 29 April 2010 (CEST)
<dt class="note">'''[[User:Alef|alef]]'''
<dt class="note">'''[[User:Alef|alef]]'''<dd class="note"><code>
<dd class="note">
[[for]] "_i" [[from]] 0 [[to]] 0 [[do]] {}; //will do once, with _i = 0
 
[[for]] "_i" [[from]] 0 [[to]] -1 [[do]] {}; //will not do
for "_i" from 0 to 0 do{}; //will do once, with _i=0
</code>
for "_i" from 0 to -1 do{}; //will not do
<!-- Note Section END -->
<!-- Note Section END -->
</dl>
</dl>

Revision as of 16:29, 1 August 2014

-wrong parameter ("Arma") defined!-1.00
Hover & click on the images for description

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

Syntax:
for variable
Parameters:
variable: String (must be all lowercase)
Return Value:
For Type

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 26 January 2007 (CET)
T_D
Chosen variable may not contain capital letters. for "_I" from 0 to 4 do {}; //will not work
Posted on 4 October 2011 (CET)
kju
Chosen variable may contain capital letters since OA 1.60. (Ref)
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

Bottom Section