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


Groups > comp.lang.javascript > #28886

Re: Why terminate do-while with a semi colon?

Newsgroups comp.lang.javascript
Subject Re: Why terminate do-while with a semi colon?
From "Evertjan." <exxjxw.hannivoort@inter.nl.net>
References <ff132af3-4cb1-4d31-bdff-6ffcceeab5e6@googlegroups.com> <ada828d7-6b91-4fb2-9828-d67a7369a5d4@googlegroups.com> <1bd5b53e-50b0-4c47-8839-6e95c610d700@googlegroups.com>
Date 2015-11-14 16:17 +0100
Message-ID <XnsA552A5BB38E2Beejj99@194.109.6.166> (permalink)

Show all headers | View raw


RobG <rgqld@iinet.net.au> wrote on 14 Nov 2015 in comp.lang.javascript:

> On Saturday, November 14, 2015 at 4:19:55 AM UTC+10, Scott Sauyet wrote:
>> RobG wrote:
>> > ECMA-262[1] defines a do-while loop as:
>> > 
>> >   IterationStatement : do Statement while ( Expression ) ;
>> > 
>> > I can't find a case where the terminal semicolon is required. Can
>> > someone suggest one (or more)?
>> 
>> No, I can't.  I don't see how there could ever be any ambiguity caused
>> by its absence, which is what I assume you're looking for. 

Indeed, it does "work":

var t = '', x = 12;
do { t += x + '\n' } while ( x --> 0 ) alert(t);

However, it looks horrible.

> Yes, that's what I was after. Thanks.

There should be a requirement for Javascript to look well.

-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

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


Thread

Why terminate do-while with a semi colon? RobG <rgqld@iinet.net.au> - 2015-11-13 00:30 -0800
  Re: Why terminate do-while with a semi colon? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-11-13 10:43 +0100
    Re: Why terminate do-while with a semi colon? John Harris <niam@jghnorth.org.uk.invalid> - 2015-11-15 15:12 +0000
  Re: Why terminate do-while with a semi colon? Scott Sauyet <scott.sauyet@gmail.com> - 2015-11-13 10:19 -0800
    Re: Why terminate do-while with a semi colon? RobG <rgqld@iinet.net.au> - 2015-11-14 03:28 -0800
      Re: Why terminate do-while with a semi colon? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-11-14 16:17 +0100

csiph-web