Skip to content

Ranges in case statements #25

@kevjett

Description

@kevjett

I would like the ability to convert inclusive and exclusive ranges in case statements. Ex. below:

def mymethod
    case bp_range
    when -999...0
      10
    when 1...2
      100
    when 2..5
      120
    when 6..10
      150
    when 11...40
      129
    else
      150
    end
  end

It can be modeled after the solution in this discussion: https://stackoverflow.com/questions/5619832/switch-on-ranges-of-integers-in-javascript

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions