breakWith: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(page created)
 
m (Text replacement - "(\|[pr][0-9]+ *= *[^- ]*) *- *V([a-z ])" to "$1 - v$2")
 
(9 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Command|Comments=
{{RV|type=command


|arma3dev|Game name=
|game1= arma3
|version1= 2.02


|2.02|Game version=
|gr1= Program Flow


|gr1= Program Flow |GROUP1=
|descr= Skips all loop iterations and immediately returns the given value.


| Skips all loop iterations and returns given value.|DESCRIPTION=
|s1= [[breakWith]] return


| [[breakWith]] return |SYNTAX=
|p1= return: [[Anything]] - value to be returned when iterations are skipped


|p1= return: [[Anything]] - Value to be returned when iterations are skipped |PARAMETER1=
|r1= [[Anything]]


| [[Anything]] |RETURNVALUE=  
|x1= <sqf>
// stops once _i reaches 5 and outputs 0, 1, 2, 3, 4, END
systemChat call {
for "_i" from 0 to 10 do {
if (_i == 5) then { breakWith "END"; };
systemChat str _i;
};
};
</sqf>


|x1= <code></code>|EXAMPLE1=
|seealso= [[continueWith]] [[break]] [[continue]] [[breakOut]]
 
| [[continueWith]] [[break]] [[continue]] [[breakOut]] |SEEALSO=
}}
}}

Latest revision as of 16:53, 8 November 2023

Hover & click on the images for description

Description

Description:
Skips all loop iterations and immediately returns the given value.
Groups:
Program Flow

Syntax

Syntax:
breakWith return
Parameters:
return: Anything - value to be returned when iterations are skipped
Return Value:
Anything

Examples

Example 1:
// stops once _i reaches 5 and outputs 0, 1, 2, 3, 4, END systemChat call { for "_i" from 0 to 10 do { if (_i == 5) then { breakWith "END"; }; systemChat str _i; }; };

Additional Information

See also:
continueWith break continue breakOut

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