Issue #9442 has been reported by Tsuyoshi Sawada.

----------------------------------------
Feature #9442: Multiple comparison construction with `==` and `===`
https://bugs.ruby-lang.org/issues/9442

* Author: Tsuyoshi Sawada
* Status: Open
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
----------------------------------------
I often want to write a condition that depends on multiple variables like this:

    if a == 1 and b == 2 then ...
    elsif a == 2 and b == 1 then ...
    elsif a == 2 and b == 2 then ...
    ...

In order to make this compact, I sometimes write these cases like this:

    case [a, b]
    when [1, 2] then ...
    when [2, 1] then ...
    when [2, 2] then ...
    ...

or even

    if [a, b] == [1, 2] then ...
    elsif [a, b] == [2, 1] then ...
    elsif [a, b] == [2, 2] then ...
    ...

but I feel that constructing these arrays is a waste of resource, as well as is not elegant to write.

I request a syntax feature that allows multiple comparison using `==` and `===` in the spirit of multiple assignment with `=` :

    x, y, z = :foo, :bar, :baz

so that the two examples above would be respectively written as:

    case a, b
    when 1, 2 then ...
    when 2, 1 then ...
    when 2, 2 then ...
    ...

and

    if a, b == 1, 2 then ...
    elsif a, b == 2, 1 then ...
    elsif a, b == 2, 2 then ...
    ...




-- 
http://bugs.ruby-lang.org/