Condition in Case of Select/Case statement in clas

2019-08-29 10:14发布

问题:

I've recently been tasked with updating a classic ASP page and have no experience in this language. Is it possible to write a condition into a Select statement's case like so:

Select Case <variable>
Case <value> && <if variable2 == something>
Case <value> || <if variable2 == something else>

回答1:

This uses comma syntax:

Case <value>, variable2 = something else   <--- case satisfies either condition.

You cannot build IF statements into the cases.

BTW: VBScript uses "and", "or" and "=", instead of "&&" "||" or "=="

Equal and assignment both use "=" and are context-dependent.



标签: asp-classic