Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #29279

Re: Using break in while loops bad habit?

From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: Using break in while loops bad habit?
Date 2016-01-17 09:09 +0100
Organization PointedEars Software (PES)
Message-ID <40378077.uoPSlP3H4q@PointedEars.de> (permalink)
References <94ec98fa-9956-48c9-ad34-de8d07cd6419@googlegroups.com> <569a7510$0$23823$e4fe514c@news.xs4all.nl>

Show all headers | View raw


Silvio wrote:

> On 01/16/2016 01:19 PM, jonas.thornvall@gmail.com wrote:
>> I have a question regarding the use of breaks in while loops, it seem
>> most breaks can be avoided by adding extra conditions for the loop.
>> However it somehow make it a bit harder to get the logic of the loop
>> right.
>>
>> But how does the approaches compare from performance view?
>> What was the main reason to include break in the language?
>> Is there logic that can not be resolved without a break in loop?
>>
                               [who?]
> Code using break is by a many considered broken.

That would be just “many” instead of “a many” in English, but:

<https://en.wikipedia.org/wiki/Weasel_word>

> I have no problem with break if the non-break equivalent is hard to read

Code that is harder to read than it needs to be is bad code.  Because such 
code is also harder to understand and maintain than it needs to be.

> or needs additional variables The latter usually implies the former).

The number of variables on code is to be minimized.  Code that introduces 
variables just for the sake of them is bad code.  Because such code is 
harder to understand and maintain, and less efficient, than it needs to be.

Yours is neither a sound argument nor a professional attitude – to be 
expected by someone who posts only with their first name, if that, and with 
a fake e-mail address that abuses a foreign namespace (of internet.com).

<https://www.xs4all.nl/over-xs4all/voorwaarden.htm>
<http://www.interhack.net/pubs/munging-harmful/>

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not cc me. / Bitte keine Kopien per E-Mail.

Back to comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Using break in while loops bad habit? jonas.thornvall@gmail.com - 2016-01-16 04:19 -0800
  Re: Using break in while loops bad habit? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-01-16 13:59 +0100
    Re: Using break in while loops bad habit? Philip Herlihy <thiswillbounceback@you.com> - 2016-01-16 15:41 +0000
      Re: Using break in while loops bad habit? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-01-16 16:41 -0800
  Re: Using break in while loops bad habit? Philip Herlihy <thiswillbounceback@you.com> - 2016-01-16 13:02 +0000
    Re: Using break in while loops bad habit? Tim Streater <timstreater@greenbee.net> - 2016-01-16 13:43 +0000
      Re: Using break in while loops bad habit? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-01-16 14:56 +0100
        Re: Using break in while loops bad habit? Gene Wirchenko <genew@telus.net> - 2016-01-18 09:39 -0800
          Re: Using break in while loops bad habit? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-01-18 19:16 +0100
            Re: Using break in while loops bad habit? Gene Wirchenko <genew@telus.net> - 2016-01-23 10:32 -0800
              Re: Using break in while loops bad habit? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-01-24 00:49 +0100
                Re: Using break in while loops bad habit? Gene Wirchenko <genew@telus.net> - 2016-01-25 21:36 -0800
                Re: Using break in while loops bad habit? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-01-26 10:12 +0100
                Re: Using break in while loops bad habit? Gene Wirchenko <genew@telus.net> - 2016-01-26 11:11 -0800
                Re: Using break in while loops bad habit? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-01-26 22:48 +0100
                Re: Using break in while loops bad habit? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-01-26 15:03 -0800
                Re: Using break in while loops bad habit? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-01-27 00:51 +0100
              Re: Using break in while loops bad habit? Norman Peelman <npeelman@cfl.rr.com> - 2016-01-23 21:00 -0500
                Re: Using break in while loops bad habit? Gene Wirchenko <genew@telus.net> - 2016-01-25 21:39 -0800
                Re: Using break in while loops bad habit? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-01-26 10:17 +0100
                Re: Using break in while loops bad habit? Doc O'Leary  <droleary@2015usenet1.subsume.com> - 2016-01-26 17:10 +0000
                Re: Using break in while loops bad habit? Doc O'Leary  <droleary@2015usenet1.subsume.com> - 2016-01-26 16:44 +0000
                Re: Using break in while loops bad habit? Gene Wirchenko <genew@telus.net> - 2016-01-26 11:17 -0800
                Re: Using break in while loops bad habit? Doc O'Leary  <droleary@2015usenet1.subsume.com> - 2016-01-27 05:00 +0000
                Re: Using break in while loops bad habit? Gene Wirchenko <genew@telus.net> - 2016-01-27 09:29 -0800
            Re: Using break in while loops bad habit? Norman Peelman <npeelman@cfl.rr.com> - 2016-01-23 20:53 -0500
              Re: Using break in while loops bad habit? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-01-24 10:28 +0100
              Re: Using break in while loops bad habit? Gene Wirchenko <genew@telus.net> - 2016-01-25 21:41 -0800
      Re: Using break in while loops bad habit? Robert Heller <heller@deepsoft.com> - 2016-01-16 09:06 -0600
        Re: Using break in while loops bad habit? Tim Streater <timstreater@greenbee.net> - 2016-01-16 17:31 +0000
        Re: Using break in while loops bad habit? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-01-16 16:52 -0800
  Re: Using break in while loops bad habit? Aleksandro <aleksandro@gmx.com> - 2016-01-16 12:43 -0300
  Re: Using break in while loops bad habit? Silvio <silvio@internet.com> - 2016-01-16 17:51 +0100
    Re: Using break in while loops bad habit? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-01-17 09:09 +0100
      Re: Using break in while loops bad habit? John Harris <niam@jghnorth.org.uk.invalid> - 2016-01-17 11:19 +0000
      Re: Using break in while loops bad habit? Silvio <silvio@internet.com> - 2016-01-18 00:40 +0100
        Re: Using break in while loops bad habit? Andrew Poulos <ap_prog@hotmail.com> - 2016-01-18 13:53 +1100
          Re: Using break in while loops bad habit? Silvio <silvio@internet.com> - 2016-01-18 07:59 +0100
  Re: Using break in while loops bad habit? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-01-16 16:34 -0800
    Re: Using break in while loops bad habit? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-01-17 01:29 +0000
      Re: Using break in while loops bad habit? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-01-17 19:22 -0800
        Re: Using break in while loops bad habit? Tim Streater <timstreater@greenbee.net> - 2016-01-18 10:00 +0000
        Re: Using break in while loops bad habit? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-01-18 10:50 +0000
          Re: Using break in while loops bad habit? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-01-20 16:40 -0800
            Re: Using break in while loops bad habit? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-01-21 01:50 +0000
      Re: Using break in while loops bad habit? Dr J R Stockton <reply1600@merlyn.demon.co.uk.invalid> - 2016-01-18 22:55 +0000
        Re: Using break in while loops bad habit? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-01-18 16:10 -0800
    Re: Using break in while loops bad habit? Gene Wirchenko <genew@telus.net> - 2016-01-18 09:46 -0800
      Re: Using break in while loops bad habit? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-01-18 10:16 -0800
      Re: Using break in while loops bad habit? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-01-18 19:18 +0100
        Re: Using break in while loops bad habit? Gene Wirchenko <genew@telus.net> - 2016-01-23 10:33 -0800
          Re: Using break in while loops bad habit? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-01-24 00:51 +0100
            Re: Using break in while loops bad habit? Gene Wirchenko <genew@telus.net> - 2016-01-25 21:46 -0800
              Re: Using break in while loops bad habit? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-01-26 10:22 +0100
                Re: Using break in while loops bad habit? Gene Wirchenko <genew@telus.net> - 2016-01-26 11:19 -0800
      Re: Using break in while loops bad habit? Doc O'Leary  <droleary@2015usenet1.subsume.com> - 2016-01-19 16:48 +0000

csiph-web