switch – Talk

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
 
m (Text replacement - "<code>" to "<code style="display: block">")
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
'''switch''' is case sensitive when comparing strings!
'''switch''' is case sensitive when comparing strings!
<code>switch (primaryWeapon player) do {
<code style="display: block">switch (primaryWeapon player) do {
case "m4gl": {hint "never work since primaryweapon returns M4GL"};
case "m4gl": {hint "never work since primaryweapon returns M4GL"};
};
};
</code> --[[User:Doolittle|Doolittle]] 06:25, 18 July 2007 (CEST)
</code> --[[User:Doolittle|Doolittle]] 06:25, 18 July 2007 (CEST)
== Feature Request: ==
the ability to drop through cases something like below:
see also http://en.wikipedia.org/wiki/Switch_statement
switch( rank ) {
case "General":
case "Major":
case "Colonel": {
hint "An officer and a gentleman";
};
case "Sergant":
case "Leutenant": {
hint "NCO";
};
default: {
hint "cannon fodder";
};
}
[[User:BarmyArmy|BarmyArmy]]

Latest revision as of 12:52, 11 January 2023

switch is case sensitive when comparing strings! switch (primaryWeapon player) do { case "m4gl": {hint "never work since primaryweapon returns M4GL"}; }; --Doolittle 06:25, 18 July 2007 (CEST)

Feature Request:

the ability to drop through cases something like below: see also http://en.wikipedia.org/wiki/Switch_statement


switch( rank ) {

case "General": case "Major": case "Colonel": { hint "An officer and a gentleman"; };

case "Sergant": case "Leutenant": { hint "NCO"; };

default: { hint "cannon fodder"; }; }

BarmyArmy