Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is it possible to write something like this:

switch (var){
case [var-100 to var+100]:
//do ...
break;
case [var+100 to var+200]:
//do ...
break;
case [var+200 to var+300]:
//do ...
break;
}
Posted
Comments
Brian A Stephens 27-Sep-13 9:13am    
This has nothing to do with jQuery

1 solution

you cannot do this with switch

you should be able to do in a if statement

if ( -100 < var < 100){
//do this 

}
else if ( 100 < var < 200){
//do this

}
else if ( 200 < var < 300){
//do this

}
else {
//var is not in the ranges
//do this instead
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900