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


Groups > comp.lang.ruby > #7408

* in { |key, value| value * 2 }

From dreamer <dreamer@panix.com>
Newsgroups comp.lang.ruby
Subject * in { |key, value| value * 2 }
Date 2019-07-08 15:24 +0000
Organization PANIX Public Access Internet and UNIX, NYC
Message-ID <qfvn84$bp1$1@reader1.panix.com> (permalink)

Show all headers | 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 | NextNext in thread | Find similar


Thread

* 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