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


Groups > comp.lang.javascript > #27865

Re: Why does (a,b,c) return only c?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From "Christoph M. Becker" <cmbecker69@arcor.de>
Newsgroups comp.lang.javascript
Subject Re: Why does (a,b,c) return only c?
Date Mon, 25 May 2015 14:57:50 +0200
Organization solani.org
Lines 30
Message-ID <mjv68c$tft$1@solani.org> (permalink)
References <55630af5$0$13000$c3e8da3$5496439d@news.astraweb.com> <XnsA4A5916ACD1C1eejj99@194.109.133.246>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 7bit
X-Trace solani.org 1432558668 30205 eJwNyMEBwEAEBMCWcHZJObjov4RknoND5YQTdCx2aci6LTf+5Bs9SGjuihwva+FTdntMoMr6ABi4EMI= (25 May 2015 12:57:48 GMT)
X-Complaints-To abuse@news.solani.org
NNTP-Posting-Date Mon, 25 May 2015 12:57:48 +0000 (UTC)
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0
X-User-ID eJwNx8kBwDAIA7CZCLZTxinX/iO0+okuU12IApdbOb07KSMDtQc+zDb0f3+LT/DU3AxYxugDOR8RpQ==
In-Reply-To <XnsA4A5916ACD1C1eejj99@194.109.133.246>
Cancel-Lock sha1:XN8B5j+6l3hbB3nekBh5DS/dIUQ=
X-NNTP-Posting-Host eJwNyMkBwDAIA7CVSMDQdcy1/wipnoL68QpzuGGxIhx+0s69tWo7xZ7EHyGrNTA2+x7OzbB8Ra8SwA==
Xref csiph.com comp.lang.javascript:27865

Show key headers only | View raw


Evertjan. wrote:

> Steven D'Aprano <steve@pearwood.info> wrote on 25 mei 2015 in 
> comp.lang.javascript:
> 
>> Consider:
>>
>> js> var x = (1,2,3);
>> js> x
>> 3

Because ECMAScript implementations don't have a tuple type like Python has.

> So it seems just a set of statements executed in line,
> the result value of the last one returned.

See <http://www.ecma-international.org/ecma-262/5.1/#sec-11.14> for details.

> However this errors:
> 
> (var i=4,++i,i=i*10,a=7,-3,i++);
> 
> Why?

A variable statement is not allowed in an expression, see
<http://www.ecma-international.org/ecma-262/5.1/#sec-11.1>.

-- 
Christoph M. Becker

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


Thread

Why does (a,b,c) return only c? Steven D'Aprano <steve@pearwood.info> - 2015-05-25 21:43 +1000
  Re: Why does (a,b,c) return only c? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-25 14:17 +0200
    Re: Why does (a,b,c) return only c? Luuk <luuk@invalid.lan> - 2015-05-25 14:42 +0200
      Re: Why does (a,b,c) return only c? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-25 14:58 +0200
    Re: Why does (a,b,c) return only c? "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-05-25 14:57 +0200
      Re: Why does (a,b,c) return only c? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-25 15:07 +0200
        Re: Why does (a,b,c) return only c? "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-05-25 15:32 +0200
          Re: Why does (a,b,c) return only c? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-25 17:50 +0200
        Re: Why does (a,b,c) return only c? Luuk <luuk@invalid.lan> - 2015-05-25 19:53 +0200
          Re: Why does (a,b,c) return only c? "D. Aaron Sawyer" <aaron@110.net> - 2015-05-25 19:49 -0300
  Re: Why does (a,b,c) return only c? John-Paul Stewart <jpstewart@sympatico.ca> - 2015-05-25 13:58 -0400
    Re: Why does (a,b,c) return only c? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-25 21:57 +0200
      Re: Why does (a,b,c) return only c? Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2015-05-25 19:24 -0300
        Re: Why does (a,b,c) return only c? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-05-26 12:26 +0200
          Re: Why does (a,b,c) return only c? Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2015-05-26 09:36 -0300
            Re: Why does (a,b,c) return only c? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-05-26 14:42 +0200
              Re: Why does (a,b,c) return only c? Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2015-05-26 09:53 -0300
                Re: Why does (a,b,c) return only c? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-26 15:15 +0200
                Re: Why does (a,b,c) return only c? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-05-26 15:17 +0200
          Re: Why does (a,b,c) return only c? Scott Sauyet <scott.sauyet@gmail.com> - 2015-05-26 08:59 -0700

csiph-web