01.09.2016, 20:27
Quote:
of course you have to break or return each case, as it will fall through to next....
if u know how paste this code in browsers js console and see what happens Код:
var test = function () { var a = 1, b = 'Nothing'; switch (a) { case 1: b = 'One'; case 2: b = 'Two'; default: b = 'Unknown'; } return b; } test(); |
pawn Код:
new a = 1, b[8] = "Nothing";
switch (a)
{
case 1:
b = "One";
case 2:
b = "Two";
default:
b = "Unknown";
}
print(b);