Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.ruby > #5076
| From | Kaye Ng <sbstn26@yahoo.com> |
|---|---|
| Newsgroups | comp.lang.ruby |
| Subject | to Adam Prescott, |
| Date | 2011-05-26 02:42 -0500 |
| Organization | Service de news de lacave.net |
| Message-ID | <67a3f63e620fc8ba989ffba0fce9ba88@ruby-forum.com> (permalink) |
| References | <973cac1dd063c9b58788432c1267c14e@ruby-forum.com> |
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 | Next — Previous in thread | Next in thread | Find similar | Unroll 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