Switch case logical expression statement in Java - versus JS or PHP -


in javascript , i've seen in php : can use logical expression inside cases : example :

switch(true){ case (d<10): document.write("less 10"); break; case (d==10): document.write("equal 10"); break; case (d>10): document.write("greater 10"); break; default: document.write("some dumb error. not number."); } 

i wondering if can in java ... needed compare large range.

case 1 : case 2 : ... case 5000: case 5001: default: 

it tedious do. wrap cases inside if statements wondering done in javascript or php.

no cannot using switch in java. have use if-else accomplish this.

see link more details.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -