Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8766067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:27:21+00:00 2026-06-13T16:27:21+00:00

I am trying to learn Ruby and I have the following code a[0]={ :artist

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T16:27:22+00:00Added an answer on June 13, 2026 at 4:27 pm
    a.select { |song| song[:artist] == 'Metallica' }
    

    and for your second question

    a.select { |song| song[:name].include? 'Song' }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello I'm trying to learn ruby blocks. But I have a trouble to get
I've recently installed Ruby on Rails 3.2 and have been trying to learn it.
I am trying to learn ruby and have a doubt regarding passing arrays of
I have recently begun the process of trying to learn Ruby/Rails and have been
I am trying to learn Ruby on Rails, I have followed the instructions from
I am trying to learn Ruby on rails following the Agile Web Development with
I'm trying to learn Ruby as well as Ruby on Rails right now. I'm
I am trying to learn Ruby on Rails using this Rails Tutorial. Earlier, I
I am trying to learn Ruby on Rails by playing around with stuff and
I am trying to learn Ruby on Rails and trying to write some of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.