![]() |
Available news archives:
comp.lang.tcl
-
comp.lang.python
-
comp.security.firewalls
-
sci.crypt -
comp.lang.php -
comp.lang.javascript
|
|
comp.lang.javascript archiveRe: Switch() Statement Not Working
From: Lasse Reichstein Nielsen <lrn@hotpop.com>
Date: Wed Feb 01 2006 - 02:12:54 CET
rdavis7408@gmail.com writes:
> The calculation worked until I added the switch statement. Why is that?
> switch(b)
You are guessing blindly. That rarely works in programming, since
The syntax of a case statement is:
Example:
switch(num){
In your case, you want to match intervals, not values, so
if (b >= 1.25 && b <= 1.30) {
You can get the same effect with a switch, but it's not really
switch(true) {
/L
-- Lasse Reichstein Nielsen - lrn@hotpop.com DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html> 'Faith without judgement merely degrades the spirit divine.'Received on Tue Feb 7 21:29:28 2006 |