continueWith: Difference between revisions

From Bohemia Interactive Community
m (Text replacement - "\|game([0-9]) ?= (.+) \|version([0-9]) ?= (.+) " to "|game$1= $2 |version$3= $4 ")
mNo edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 10: Line 10:
|s1= [[continueWith]] return
|s1= [[continueWith]] return


|p1= return: [[Anything]] - Value to be returned when iteration is skipped
|p1= return: [[Anything]] - value to be returned when iteration is skipped


|r1= [[Anything]]
|r1= [[Anything]]


|x1= The result of this code will be {{ic|[2, "TEST", 4]}}.
|s2= scriptHandle [[continueWith]] code
<code>[1, 2, 3] [[apply]] {
|s2since= arma3 2.22
[[if]] (_x == 2) [[then]] {
|p21= scriptHandle: [[Script Handle]]
[[continueWith]] "TEST";
|p22= code: [[Code]] - Code to execute once the [[Script_Handle#Promise_Handles|Promise]] has completed. The code will be executed in [[Scheduler#Unscheduled_Environment|Unscheduled Environment]].
} [[else]] {
|r2= [[Nothing]]
_x + 1
 
 
 
|x1= <sqf>
// results in [2, "TEST", 4]
private _result = [1, 2, 3] apply {
if (_x == 2) then {
continueWith "TEST";
} else {
_x + 1;
};
};
};</code>
};
</sqf>


|seealso= [[continue]] [[break]] [[breakWith]]
|seealso= [[continue]] [[break]] [[breakWith]]
}}
}}

Latest revision as of 17:59, 10 July 2025

Hover & click on the images for description

Description

Description:
Skips the current loop iteration, continues with the next one and returns the given value.
Groups:
Program Flow

Syntax

Syntax:
continueWith return
Parameters:
return: Anything - value to be returned when iteration is skipped
Return Value:
Anything

Alternative Syntax

Syntax:
scriptHandle continueWith code
Parameters:
scriptHandle: Script Handle
code: Code - Code to execute once the Promise has completed. The code will be executed in Unscheduled Environment.
Return Value:
Nothing

Examples

Example 1:
// results in [2, "TEST", 4] private _result = [1, 2, 3] apply { if (_x == 2) then { continueWith "TEST"; } else { _x + 1; }; };

Additional Information

See also:
continue break breakWith

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