From Bohemia Interactive Community
Notes
- Posted on 07 Aug, 2008
- 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).
- Posted on 12 Aug, 2008
- General Barron
-
To be safe about the case sensitivity issue, use the toLower or toUpper command to force all strings to a certain case.
- Posted on 06 Oct, 2009
- Iva
-
It's possible to use Boolean value as a switch and Code as case. One thing to take special care in such case is that code must be in parentheses. Example:
switch (true) do
{
case (_boolVar): {someCode};
case (unit1 distance unit2 > 5): {someCode};
};