Path: csiph.com!news.swapon.de!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.javascript Subject: Re: Using break in while loops bad habit? Date: Sun, 17 Jan 2016 09:09:58 +0100 Organization: PointedEars Software (PES) Lines: 42 Message-ID: <40378077.uoPSlP3H4q@PointedEars.de> References: <94ec98fa-9956-48c9-ad34-de8d07cd6419@googlegroups.com> <569a7510$0$23823$e4fe514c@news.xs4all.nl> Reply-To: Thomas 'PointedEars' Lahn Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Trace: solani.org 1453018200 3315 eJwFwYEBwCAIA7CXBNqq5yCD/09YwpCpNkSBw3k5xlzdAY/a0xnEmnuup14Vzepzc3gSR/wBKHYQ7g== (17 Jan 2016 08:10:00 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Sun, 17 Jan 2016 08:10:00 +0000 (UTC) User-Agent: KNode/4.14.2 X-User-ID: eJwFwQkBwDAIA0BLhfAUOTQM/xJ25wgJpoWH+freJq7WIdfQBc3R9aqOfdMNr6yBpGAqiq5yOGm93+MS8QNTjBXS Cancel-Lock: sha1:+5/4U1Fgub0lxpJaH4HSPq+QnCc= X-NNTP-Posting-Host: eJwNwocRwDAIBLCVAk+xx6HuP4JzksLIysXURPeXGsTRB9eEa3HZiyKblj8/WRhojxTgPMADGhsQ9A== Xref: csiph.com comp.lang.javascript:29279 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: > 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). -- PointedEars FAQ: | SVN: Twitter: @PointedEars2 | ES Matrix: Please do not cc me. / Bitte keine Kopien per E-Mail.