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 8881709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:23:57+00:00 2026-06-14T20:23:57+00:00

I have four sizes, each are in a hash by their square feet: #

  • 0

I have four sizes, each are in a hash by their square feet:

# The sizes. Sizes are in sq ft (min, max)
size_hash = {
  'Large'  => [70,139],
  'Medium' => [15,69],
  'Small'  => [1,14]
}

If I’m given the number 40, how can I return Medium as the size from the array?

Do I need to do something like this?:

# The sizes. Sizes are in sq ft (min, max)
size_hash = {
  [70..139]  => 'Large',
  #... etc
}
  • 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-14T20:23:58+00:00Added an answer on June 14, 2026 at 8:23 pm

    You could use a proc:

    size_store = proc{ |n|
      case n
      when 70..139
        'Large'
      when 15..69
        'Medium'
      when 1..14
        'Small'
      end
    }
    # USAGE: size_store[40]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a main Event class, and four event types. Each of them is
I have four product gallery with the possibility to check the detail of each
I have some databases that have four files each; one for PRIMARY, IDX, IMAGE,
Each product in my database can have at least three and sometimes four or
i have four div in one parent and each contains one image. i want
I have four buttons arranged in a 2x2 TableLayout. These buttons each have an
I saw this question somewhere Four processes p1, p2, p3, p4 - each have
I have an MSM install with four (licensed) sites. Three of them work perfectly
Preamble To build dynamic web-sites, we have to master at least four languages: HTML
I have four activities namely, Demo_tabActivity.java [main activity] Tabhost.java The below two activities are

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.