exitWith

From Bohemia Interactive Community

Jump to: navigation, search
Editors, please check Policy: Scripting Command Page Syntax.
Introduced in Armed Assault version 1.00

Click on the images for descriptions

Introduced in

Game:
Armed Assault
Version:
1.00

Description

Description:
If the result of condition is true, code is evaluated, and current block with result of code. It only exits the current scope.

exitWith exits the execution of a loop defined by one of commands do, for, count or forEach. When you use exitWith not inside a loops, the behaviour is undefined - sometimes it may exit the script, sometimes some other scope, but this is not intended and designed behaviour of this command, and it is not guaranteed to work reliably.

It exits the loop only, not the script.

Syntax

Syntax:
if (condition) exitWith {Code}
Parameters:
If Type
Code
Return Value:
Anything

Examples

Example 1:
if (_x>5) exitWith {echo "_x is too big"; _x}

When _x is greater than 5, outputs message and terminates code in current level with value of _x

Example 2:
for "_j" from 1 to 10 do { player sideChat format ["%1",_j]; if (_j==5) exitWith {player sideChat "5 is enough"}; }; player sideChat "Complete"; Only the "for" loop will exit when the exitWith condition has been fulfilled (not the whole script). Execution will continue after the end of the loop (player sideChat "Complete").

Additional Information

Multiplayer:
Behaviour unknown.
See also:
scopeName, breakOut, breakTo, else, Control Structures, then

Notes

Notes

+ Add Note

Only post proven facts here. Use the talk page or the forums for discussions.

Notes

Bottom Section

Personal tools
Buy ArmA now!