Leo*_*ban 1 flash case actionscript-3 switch-statement
嗨,我希望找到正确的语法,以便更好地组织Flash AS3中的Case语句.所以下面例如不是有3个案例陈述,我不能以某种方式组织成1个案例吗?
switch (refID)
{
case "TS_38":
pgBool = true;
break;
case "TS_37":
pgBool = true;
break;
case "TS_36":
pgBool = true;
break;
default:
pgBool = false;
//break;
}
Run Code Online (Sandbox Code Playgroud)
我尝试了这个,但它在我的测试中没有用:
switch (refID)
{
case "TS_38", "TS_37", "TS_36":
pgBool = true;
break;
default:
pgBool = false;
//break;
}
Run Code Online (Sandbox Code Playgroud)
试试这个:
switch (refID)
{
case "TS_38":
case "TS_21":
case "TS_21":
pgBool = true;
break;
default:
pgBool = false;
//break;
Run Code Online (Sandbox Code Playgroud)
}