Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.ruby > #7408
| Path | csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!not-for-mail |
|---|---|
| From | dreamer <dreamer@panix.com> |
| Newsgroups | comp.lang.ruby |
| Subject | * in { |key, value| value * 2 } |
| Date | Mon, 8 Jul 2019 15:24:53 +0000 (UTC) |
| Organization | PANIX Public Access Internet and UNIX, NYC |
| Lines | 24 |
| Message-ID | <qfvn84$bp1$1@reader1.panix.com> (permalink) |
| NNTP-Posting-Host | panix1.panix.com |
| X-Trace | reader1.panix.com 1562599493 12065 166.84.1.1 (8 Jul 2019 15:24:53 GMT) |
| X-Complaints-To | abuse@panix.com |
| NNTP-Posting-Date | Mon, 8 Jul 2019 15:24:53 +0000 (UTC) |
| User-Agent | tin/2.4.3-20181224 ("Glen Mhor") (UNIX) (NetBSD/7.1.2 (amd64)) |
| Xref | csiph.com comp.lang.ruby:7408 |
Show key headers only | View raw
Hi all,
I'm new to ruby and trying to understand this bit of code:
hash.update(hash) { |key, value| value * 2}
In particular what is the meaning of the value * 2?
When I tried using IRB to multiply values in a hash, either
I received an error or it multiplied the values and gave me
the product.
Any insights would be greatly appreciated. Thank you.
--
--
danny lee <dreamer@panix.com> (fka dan1mal@mindvox.com, dreamer@escape.com)
"I remarked to Dennis [Ritchie] that easily half the code I was writing in
Multics was error recovery code. He said, "We left all that stuff out [of
Unix]. If there's an error, we have this routine called panic, and when it
is called, the machine crashes, and you holler down the hall, 'Hey, reboot
it.'"- Tom Van Vleck.
Back to comp.lang.ruby | Previous | Next — Next in thread | Find similar
* in { |key, value| value * 2 } dreamer <dreamer@panix.com> - 2019-07-08 15:24 +0000
Re: * in { |key, value| value * 2 } Doc O'Leary <droleary@2017usenet1.subsume.com> - 2019-07-14 15:44 +0000
Re: * in { |key, value| value * 2 } dreamer <dreamer@panix.com> - 2019-07-16 15:27 +0000
Re: * in { |key, value| value * 2 } Doc O'Leary <droleary@2017usenet1.subsume.com> - 2019-07-16 19:44 +0000
Re: * in { |key, value| value * 2 } dreamer <dreamer@panix.com> - 2019-07-17 23:21 +0000
csiph-web