Quote:
> If I have:
> case 'whatever' : return 'something';
> does the return statement also accomplish
>a break by itself, or would it
> have to be 'return false'?
I would AFAIK say, that it will exit your
subprocedure and no "break" is needed in this case.
I read you sort of beeing more happy that
you can put multiple values into case statement,
but I would rather not be so. Why ?
But what is *WEAK* by C(++) and JavaScript
related to TPascal is that it has no "range type"
like TPascal has like:
CASE mynumber OF
-11,-12 : Begin (* Numbers -11 and -12 *)
writeln('');
End;
0..10 : Begin (* The numbers range between 0 and 10 -> range type*)
writeln('');
End;
11 : Begin (* Number 11 *)
writeln('');
End;
ELSE Begin (*default part.*)
writeln('None of above numbers');
End;
END;
With JavaScript it is IMPOSSIBLE such construct
to do .... And thatswhy the code:
switch(mynumber){
case -11:
case -12: /* Numbers -11 and -12 */
writeln('');
break;
/* !!!!!!!!!*/
case (>0)&&(<10): /* The numbers range between 0 and 10 */
writeln('');
break;
/* !!!!!!!!!*/
case 11: /* Number 11 */
writeln('');
break;
default: (*default part.*)
writeln('None of above numbers');
}
doesnt make any sense. Btw the "switch" was introduced
in JS1.2, so I'd prefer the "if else" construct
if it doesnt handle small amount of discrete values.
Also you get your code working then by MSIE3,
and all pre Netscape4s aswell as Operas, hich dont
support "switch". And the switch is absolutely
impotent if it comes to number ranges.
Make your own conclusions from my posting.
That is: many of javascripters would be happier
if range type would be implemented.
MM anno MM (Marek M?nd aus Estland)
http://my.tele2.ee/cadorsoft/cdr_js_pkb/links.htm