for forspec: Difference between revisions
Jump to navigation
Jump to search
m (VBS2 scripting category removal) |
(for forspec support boolean control & see also) |
||
Line 15: | Line 15: | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
|x1 = <code> '''for''' [{_x<nowiki>=</nowiki>1},{_x<<nowiki>=</nowiki>10},{_x<nowiki>=</nowiki>_x+1}] [[do]] {[[debugLog]] _x;} </code> | |x1 = <code> '''for''' [{_x<nowiki>=</nowiki>1},{_x<<nowiki>=</nowiki>10},{_x<nowiki>=</nowiki>_x+1}] [[do]] {[[debugLog]] _x;} </code> | ||
| [[Control Structures]] |= See also | | [[Control Structures]], [[for do]] |= See also | ||
}} | }} | ||
Line 22: | Line 22: | ||
<dl class="command_description"> | <dl class="command_description"> | ||
<!-- Note Section BEGIN --> | <!-- Note Section BEGIN --> | ||
<dd class="notedate">Posted on Apr 15, 2014 - 12:54 | |||
<dt class="note">'''[[User:ffur2007slx2_5|ffur2007slx2_5]]'''<dd class="note"> | |||
In ArmA3 ver 1.16 Please note the difference between [[for forspec]] and [[for do]], [[for forspec]] detects Boolean in each scope while [[for do]] doesn’t. e.g. | |||
{| class="wikitable sortable" | |||
! command | |||
! Structure | |||
! Summary | |||
|- | |||
| [[for forspec]] | |||
| | |||
a= 0; b = true; | |||
for [{_i = 0},{_i < 10 && b},{_i = _i + 1}] do { | |||
a = a + 1; | |||
if (a >= 7) then {b = false} | |||
} | |||
| loop can be exited via Boolean control, possible workaround can be like [[BIS_fnc_areEqual]] | |||
|- | |||
| [[for do]] | |||
| | |||
a= 0; | |||
for "_i" from 0 to 10 do { | |||
a = a + 1; | |||
if (a >= 7) exitwith {} | |||
}; | |||
| have to be exited via [[exitWith]] | |||
|} | |||
<!-- Note Section END --> | <!-- Note Section END --> | ||
</dl> | </dl> |
Revision as of 05:58, 15 April 2014
Description
- Description:
- Creates cycle, using C like style. See example.
- Groups:
- Uncategorised
Syntax
Examples
Additional Information
- See also:
- Control Structuresfor do
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 Apr 15, 2014 - 12:54
- ffur2007slx2_5
-
In ArmA3 ver 1.16 Please note the difference between for forspec and for do, for forspec detects Boolean in each scope while for do doesn’t. e.g.
command Structure Summary for forspec a= 0; b = true; for [{_i = 0},{_i < 10 && b},{_i = _i + 1}] do { a = a + 1; if (a >= 7) then {b = false} }
loop can be exited via Boolean control, possible workaround can be like BIS_fnc_areEqual for do a= 0; for "_i" from 0 to 10 do { a = a + 1; if (a >= 7) exitwith {} };
have to be exited via exitWith