I am trying to learn Ruby and I have the following code
a[0]={ :artist => 'Green Day',
:name => 'Song1',
:bitrate => 192 }
a[1]={ :artist => 'U2', :name => 'Song2' }
a[2]={:artist => 'Metallica', :name => 'Battery' }
My question is how do I find in such an array all the songs by Metallica, for example? Thank you! 🙂
Edit: Ok, another newbie question? How can I find the songs that contain a certain sequence in their titles?
I tried:
a.find { |x| x[:song].include? 'Song' }
but it returns an error.
and for your second question