switch do

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:
Switch form.

Syntax

Syntax:
switch do block
Parameters:
switch: Switch Type
block: Code
Return Value:
Anything

Examples

Example 1:
switch (_a) do {case 1: {hint "1"}; case 2: {hint "2"}; default {hint "default"};}
Example 2:
switch (_a) do {case true: {hint "true"}; case false: {hint "false"}; default {hint "default"};}
Example 3:
switch (_a) do {case "string1": {hint "string1"}; case "string2": {hint "string2"}; default {hint "default"};}

Additional Information

Multiplayer:
Behaviour unknown.
See also:
Control Structures

Notes

Notes

+ Add Note

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

Notes

ColonelSandersLite

Be careful of the parenthesis around the variable you're switching on. If you accidentally use braces instead (ex: switch {_myVar} do{...), it won't error, but will always return default.

Posted on 11 Aug, 2008
Dr_Eyeball
Using switch with strings is case-sensitive, (unlike string comparisons).

General Barron
To be safe about the case sensitivity issue, use the toLower or toUpper command to force all strings to a certain case.


Personal tools
Buy ArmA now!