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


Groups > comp.lang.javascript > #15605

Re: Semicolons and the do..while statement

Newsgroups comp.lang.javascript
Subject Re: Semicolons and the do..while statement
From "Evertjan." <exxjxw.hannivoort@inter.nl.net>
References <88f8c6ba-bc50-4695-b442-10f1dc377363@o8g2000yqm.googlegroups.com> <503e0c75$0$6219$ba4acef3@reader.news.orange.fr> <XnsA0BE9F9347Aeejj99@194.109.133.133> <503e39ac$0$6177$ba4acef3@reader.news.orange.fr>
Message-ID <XnsA0BEC545BEFEeejj99@194.109.133.133> (permalink)
Date 2012-08-29 17:23 +0000

Show all headers | View raw


SAM wrote on 29 aug 2012 in comp.lang.javascript:

> Le 29/08/12 15:41, Evertjan. a écrit :
>>
>> Try for fun:
>>
>> var x=73;
>> do ; while (x--) alert(x);
>>
>> This will start an endless loop btw:
> 
> that seems normal, no ?

No

You missquote, leaving out the essential:

var x = -73;

While "normality" is a strange beast, 
it certainly is conforming to the specs.

However, that does not mean there is no gain in studying it.

> same as :
> 
> do{} while(x--)   // will do nothing 73 times (or by there)
> alert(x)          // x would be -1, no?

The new line being just white space to javascript. 



-- 
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

Re: Semicolons and the do..while statement SAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> - 2012-08-29 14:35 +0200
  Re: Semicolons and the do..while statement "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2012-08-29 13:41 +0000
    Re: Semicolons and the do..while statement SAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> - 2012-08-29 17:47 +0200
      Re: Semicolons and the do..while statement "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2012-08-29 17:23 +0000

csiph-web