Arma 3 Scripting

Command in Program Flow

breakOut

Also available as Markdown and JSON, or read the original wiki page.

Description

Breaks out of the scope with given name.

Syntax

Syntax 1

breakOut name

Parameters:

Returns: Nothing

Syntax 2

since arma3 1.48

value breakOut name

Parameters:

Returns: Anything - will return value

Examples

Example 1

scopeName "main";
while { true } do {
    scopeName "loop1";
    while {true} do {
        scopeName "loop2";
        if (condition1) then {breakTo "main"}; // Breaks all scopes and return to "main"
        if (condition2) then {breakOut "loop2"}; // Breaks scope named "loop2"
        sleep 1;
    };
    sleep 1;
};

Example 2

call {
    scopeName "main";
    call {
        123 breakOut "main"
    };
    345
}; // call returns 123

Example 3

call {
    scopeName "Main"; // Parent Main
    call {
        scopeName "Main"; // Child Main
        "String" breakOut "Main"; // Will break out of child main and return "String" to parent main
    };
};

See also

scopeName · breakTo · exitWith