Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
Is there a way to have non-constant case labels (i.e. ranges or arbitrary expressions)?
Is there a way to have non-constant case labels (i.e. ranges or arbitrary expressions)?
✍: Guest
No. The switch statement was originally designed to be quite simple for the compiler to translate, therefore case labels are limited to single, constant, integral expressions. You can attach several case labels to the same statement, which will let you cover a small range if you don't mind listing all cases explicitly.
If you want to select on arbitrary ranges or non-constant expressions, you'll have to use an if/else chain.
2015-02-02, 1258👍, 0💬
Popular Posts:
What is Traceability Matrix? Traceability Matrix is one of the document will prepare by QA.To make s...
How can I implement a variable field width with printf? That is, instead of something like %8d, I wa...
How many types of validation controls are provided by ASP.NET ? There are six main types of validati...
What Is a TD Tag/Element? - XHTML 1.0 Tutorials - Understanding Tables and Table Cells A "td" elemen...
How To Delete All Rows a Table? - MySQL FAQs - Understanding SQL INSERT, UPDATE and DELETE Statement...