Testing for Multiple Conditions
<HTML>
<HEAD>
<TITLE>Testing for Multiple Conditions</TITLE>
</HEAD>
<BODY>
<H1>Testing for Multiple Conditions</H1>
<%
int temperature = 64;
switch(temperature) {
case 60:
case 61:
case 62:
out.println("Sorry, too cold!");
break;
case 63:
case 64:
case 65:
out.println("Pretty cool.");
break;
case 66:
case 67:
out.println("Nice!");
break;
case 70:
case 74:
case 75:
out.println("Fairly warm.");
break;
default:
out.println("Too hot!");
}
%>
</BODY>
</HTML>
Related examples in the same category