[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Hash/2-d array help!

Li Chen

12/14/2006 7:08:00 PM


> Ah....now that's a lot simpler then I thought.
> How would I then retrieve these values?
>
> puts hash gives error as does puts hash[England] or
> puts
> hash{England}...Are they counted in anyway like
> hash{england[1]}?

Hi,

This is right syntax to create a hash(with single or
double quotes), actually you declare a hash of
arrays(HOA):


hash = {
'England' => ['Liverpool', 'London',
'Plymouth'],
'France' => ['Rennes', 'Paris']
}

If you just write
England=>[Liverpool, London, Plymouth]

Ruby thinks every of them is a constant due to
capitalization.


hash.fetch('England') will return an array then you
index the array to get the element you want.

Li

C:\>irb
irb(main):001:0> hash = {
irb(main):002:1* 'England' => ['Liverpool',
'London', 'Plymouth'],
irb(main):003:1* 'France' => ['Rennes', 'Paris']
irb(main):004:1> }
=> {"France"=>["Rennes", "Paris"],
"England"=>["Liverpool", "London", "Plymouth"]}
irb(main):005:0> hash.fetch('England')[0]
=> "Liverpool"
irb(main):006:0> hash.fetch('England')[2]
=> "Plymouth"
irb(main):007:0>




____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail...

1 Answer

Gerard

5/18/2012 8:54:00 PM

0

richard.simnett@gmail.com <richard.simnett@gmail.com> typed:
> On May 17, 5:44 am, "Gerard" <ghendrik-nospam_...@hotmail.com> wrote:

> >
> > Can you tell me why someone would be a Silvestri addict?
> > I think I have 1 or 2 of his recordings (one of them 'being' a
> > Manfred). What's special about his recordings?
>
> When he was 'on' his recordings show a flexible pulse and real dynamic
> control of the orchestra, so that his Tchaikovsky Ss4-6 recordings
> (which were the first HMV stereo recordings of them) can, if you
> respond to them, make Mengelberg seen straight and Svetlanov
> unemotional.

Thanks.
Could these recordings be compared to Mravinsky's?