hello. i've been beating my head against a wall over this for too
long.
setting the variables 'z' or 'y' to differing numbers, the following
'if/else' code snippet works fine; however, the 'case' code snippet
does not. (the code's function is illustrative.)
//////////////////////////////////////////
//////// working 'if/else' switch ////////
//////////////////////////////////////////
var z=3 /* set 'z' to any number */
if (z<10)
{
document.write("The value of 'z' entered is less than ten.
<br><br>")
}
else if (z==10)
{
document.write("The value of 'z' entered is exactly equal to
ten.<br><br>")
}
else if (z>10)
{
document.write("The value of 'z' entered is greater than ten.
<br><br>")
}
//////////////////////////////////////////
//////////////////////////////////////////
//////////////////////////////////////////
//////////////////////////////////////////
/////// non-working 'case' switch ////////
//////////////////////////////////////////
var y=15 /* set 'y' to any number */
switch (y)
{
case (y<10):
document.write("The value of 'y' entered is less than ten.
<br><br>")
break
case (y==10):
document.write("The value of 'y' entered is exactly ten. <br><br>")
break
case (y>10):
document.write("The value of 'y' entered is greater than ten.
<br><br>")
//////////////////////////////////////////
//////////////////////////////////////////
//////////////////////////////////////////
any simple changes that will make the 'case' switch work?
tia,
c.