switch: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (added white space)
Line 39: Line 39:
[[Category:Command_Group:_Variables|{{uc:{{PAGENAME}}}}]]
[[Category:Command_Group:_Variables|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]

Revision as of 11:47, 25 March 2013

-wrong parameter ("Arma") defined!-1.00
Hover & click on the images for description

Description

Description:
See switch do
Groups:
Uncategorised

Syntax

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

Examples

Example 1:
switch (_a) do {case 1 : {block}; case 2 : {block}; default {block};}
Example 2:
_color =
switch (side player) do
{
  case west: {"ColorGreen"};
  case east: {"ColorRed"};
};
Example 3:
_fn_moveForward = { /*...code...*/ };
_fn_moveBackward = { /*...code...*/ };
_fn_invalidKey = { /*...code...*/ };

switch true do {
  case (_dikCode in actionKeys "MoveForward")  : _fn_moveForward;
  case (_dikCode in actionKeys "MoveBackward") : _fn_moveBackward;
  default _fn_invalidKey;
};

Additional Information

See also:
Control Structures

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

Notes

Bottom Section