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


Groups > comp.lang.ruby > #5076

to Adam Prescott,

X-FeedAbuse http://nntpfeed.proxad.net/abuse.pl feeded by 88.191.16.109
Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.dougwise.org!nntpfeed.proxad.net!nospam.fr.eu.org!talisker.lacave.net!lacave.net!not-for-mail
From Kaye Ng <sbstn26@yahoo.com>
Newsgroups comp.lang.ruby
Subject to Adam Prescott,
Date Thu, 26 May 2011 02:42:48 -0500
Organization Service de news de lacave.net
Lines 16
Message-ID <67a3f63e620fc8ba989ffba0fce9ba88@ruby-forum.com> (permalink)
References <973cac1dd063c9b58788432c1267c14e@ruby-forum.com>
NNTP-Posting-Host bristol.highgroove.com
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 7bit
X-Trace talisker.lacave.net 1306395787 63694 65.111.164.187 (26 May 2011 07:43:07 GMT)
X-Complaints-To abuse@lacave.net
NNTP-Posting-Date Thu, 26 May 2011 07:43:07 +0000 (UTC)
In-Reply-To <973cac1dd063c9b58788432c1267c14e@ruby-forum.com>
X-Received-From This message has been automatically forwarded from the ruby-talk mailing list by a gateway at comp.lang.ruby. If it is SPAM, it did not originate at comp.lang.ruby. Please report the original sender, and not us. Thanks! For more details about this gateway, please visit: http://blog.grayproductions.net/categories/the_gateway
X-Mail-Count 383789
X-Ml-Name ruby-talk
X-Rubymirror Yes
X-Ruby-Talk <67a3f63e620fc8ba989ffba0fce9ba88@ruby-forum.com>
Xref x330-a1.tempe.blueboxinc.net comp.lang.ruby:5076

Show key headers only | View raw


Hi Adam.  There's only one thing I don't understand:

a = 1; [2].each { |;a| p a; }; a            #=> nil; 1
a = 1; [2].each { |;a| p a; a = 2; p a }; a #=> nil; 2; 1

This is the first time I've seen a variable passed into a code block 
with a semicolon preceding it
|;a|
and also semicolon following the variable
p a;

I'm not sure what it does nor do I understand its significance. =)

-- 
Posted via http://www.ruby-forum.com/.

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


Thread

"Local variable within code blocks do not interfere with those outside the block" Kaye Ng <sbstn26@yahoo.com> - 2011-05-24 04:45 -0500
  Re: "Local variable within code blocks do not interfere with those outside the block" Adam Prescott <adam@aprescott.com> - 2011-05-24 05:08 -0500
    Re: "Local variable within code blocks do not interfere with those outside the block" Adam Prescott <adam@aprescott.com> - 2011-05-24 05:16 -0500
  to Adam Prescott, Kaye Ng <sbstn26@yahoo.com> - 2011-05-26 02:42 -0500
    Re: to Adam Prescott, Adam Prescott <adam@aprescott.com> - 2011-05-26 04:17 -0500
  Re: "Local variable within code blocks do not interfere with those outside the block" Bala TS <bdeveloper01@yahoo.com> - 2011-05-26 04:20 -0500
    Re: "Local variable within code blocks do not interfere with those outside the block" Josh Cheek <josh.cheek@gmail.com> - 2011-05-26 04:57 -0500
    Re: "Local variable within code blocks do not interfere with those outside the block" Adam Prescott <adam@aprescott.com> - 2011-05-26 05:05 -0500
  Re: "Local variable within code blocks do not interfere with those outside the block" Bala TS <bdeveloper01@yahoo.com> - 2011-05-26 07:46 -0500
  Re: "Local variable within code blocks do not interfere with those outside the block" Bala TS <bdeveloper01@yahoo.com> - 2011-05-26 23:09 -0500
  Re: "Local variable within code blocks do not interfere with those outside the block" Bala TS <bdeveloper01@yahoo.com> - 2011-05-26 23:11 -0500
    Re: "Local variable within code blocks do not interfere with those outside the block" Josh Cheek <josh.cheek@gmail.com> - 2011-05-26 23:30 -0500
      Re: "Local variable within code blocks do not interfere with those outside the block" Bala TS <bdeveloper01@yahoo.com> - 2011-05-26 23:59 -0500

csiph-web