Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #9372
| Date | 2011-12-18 20:43 +0100 |
|---|---|
| From | Stefan Weiss <krewecherl@gmail.com> |
| Newsgroups | comp.lang.javascript |
| Subject | Re: Break for last case in switch |
| References | <758d8d3d-1b7d-46a8-8dc7-8f5764138efc@q16g2000yqn.googlegroups.com> |
| Message-ID | <fbidncC--v1e33PTnZ2dnUVZ8sWdnZ2d@giganews.com> (permalink) |
On 2011-12-18 20:04, Archos wrote:
> Is ok don't add a "break" statement in the last "case" one? Because
> JavaScript Lint shows:
>
> lint warning: missing break statement for last case in switch
>
> // ===
> var x = tag
> switch (1) {
> case x < 0:
> str = "negative"; break;
> default:
> str = "positive";
> }
> // ===
JavaScript Lint is mistaken. A 'break;' at the end of the last clause in
a switch statement would be redundant. I'd say file a bug, but the
warning might even be intentional. Lint tools sometimes have odd notions
about what is and isn't "good style". At least JavaScript Lint offers a
way to exclude parts of the code from checking.
- stefan
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Break for last case in switch Archos <raul.san@sent.com> - 2011-12-18 11:04 -0800
Re: Break for last case in switch Stefan Weiss <krewecherl@gmail.com> - 2011-12-18 20:43 +0100
Re: Break for last case in switch "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2011-12-18 22:13 +0200
Re: Break for last case in switch Antony Scriven <adscriven@gmail.com> - 2011-12-18 12:21 -0800
Re: Break for last case in switch Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-12-18 21:37 +0100
Re: Break for last case in switch Stefan Weiss <krewecherl@gmail.com> - 2011-12-18 21:58 +0100
Re: Break for last case in switch Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-12-18 22:29 +0100
Re: Break for last case in switch "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2011-12-18 23:49 +0200
Re: Break for last case in switch Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-12-18 23:09 +0100
Re: Break for last case in switch "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2011-12-19 00:32 +0200
Re: Break for last case in switch Stefan Weiss <krewecherl@gmail.com> - 2011-12-18 23:25 +0100
Re: Break for last case in switch Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-12-19 00:06 +0100
Re: Break for last case in switch Stefan Weiss <krewecherl@gmail.com> - 2011-12-19 05:30 +0100
Re: Break for last case in switch Andrew Poulos <ap_prog@hotmail.com> - 2011-12-19 16:04 +1100
Re: Break for last case in switch Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-12-19 12:25 +0100
Re: Break for last case in switch "Evertjan." <exjxw.hannivoort@interxnl.net> - 2011-12-19 17:17 +0000
Re: Break for last case in switch Gene Wirchenko <genew@ocis.net> - 2011-12-19 12:19 -0800
Re: Break for last case in switch "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2011-12-19 14:47 +0200
Re: Break for last case in switch John G Harris <john@nospam.demon.co.uk> - 2011-12-19 15:50 +0000
Re: Break for last case in switch "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2011-12-19 18:45 +0200
Re: Break for last case in switch Gene Wirchenko <genew@ocis.net> - 2011-12-19 12:22 -0800
csiph-web