switch: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - " *\| *([Cc]omments|COMMENTS|Game|[Gg]ame [Nn]ame( +[0-9])?|Game [Vv]ersion( +[0-9])?|Game Version \(number surrounded by NO SPACES\)|Arguments in MP|MP[Aa]rg|Multiplayer Arguments( \("local" or "global"\))?|Effects|Execution|Effects...)
m (Text replacement - " <h3 style="display:none">Notes</h3>" to "")
Line 40: Line 40:
}}
}}


<h3 style="display:none">Notes</h3>
<dl class="command_description">
<dl class="command_description">



Revision as of 14:02, 18 January 2021

Hover & click on the images for description

Description

Description:
Creates a switch type that can be used inside a switch-do block.

When it comes to strings, switch case matching is case-sensitive
Groups:
Program Flow

Syntax

Syntax:
switch condition
Parameters:
condition: Anything
Return Value:
Switch Type

Examples

Example 1:
private _mySwitch = switch "Test"; _mySwitch do { /* Something */ };
Example 2:
switch (_condition) do { case 1: { hint "1" }; case 2: { hint "2" }; default { hint "default" }; };
Example 3:
switch (_condition) do { case "string1"; case "string2": { hint "string1 or string2" }; case "string3"; case "string4": { hint "string3 or string4" }; default { hint "default" }; };

Additional Information

See also:
Control Structures switch do a:b case default

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