switch do: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
Dr Eyeball (talk | contribs) (case sensitive note) |
||
Line 32: | Line 32: | ||
<dl class="command_description"> | <dl class="command_description"> | ||
<!-- Note Section BEGIN --> | <!-- Note Section BEGIN --> | ||
<dt class="note">'''[[User:ColonelSandersLite|ColonelSandersLite]]'''</dt><dd class="note"><br> | <dt class="note">'''[[User:ColonelSandersLite|ColonelSandersLite]]'''</dt><dd class="note"><br> | ||
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.<br> | 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.<br> | ||
</dd> | </dd> | ||
<dd class="notedate">Posted on 11 Aug, 2008</dd> | |||
<dt class="note">'''[[User:Dr_Eyeball|Dr_Eyeball]]'''</dt><dd class="note"> | |||
Using [[switch]] with strings is case-sensitive, (unlike string comparisons). | |||
</dd> | |||
<!-- Note Section END --> | <!-- Note Section END --> | ||
</dl> | </dl> |
Revision as of 08:02, 11 August 2008
Description
- Description:
- Switch form.
- Groups:
- Uncategorised
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
- 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
- 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).