Expression lists in WHEN

  • I was looking at the docs for 3.20 and noticed that the "WHEN expression lists" are implemented as "short-circuit AND's".

    Wouldn't it make more sense to implement them as "OR's"?

    I think it is very typical to use Select to test one variable against a number of constants in a way that is better served by OR.

    / Sample use as "OR" /
    When A=1, A=2, A=3 Then Say "Low"
    When A=4, A=5, A=6 Then Say "Medium"
    When A=7, A=8, A=9 Then Say "High"
    Say "Out of Range"

    I am not sure if the IF/DO is better served by "AND" or "OR".

    • Hagrinas

      Yes it should, in my opinion. But what would the syntax be? Should there be a different delimiter, a WhenAny ... type of statement, or something else?

    • I think the comma operator should be treated the same in WHEN and IF. For that reason it makes sense to bind it to the logical AND operator. It is still possible to use the OR - just use the pipe symbol.

      But that still leaves one question unanswered: shouldn't rexx have a short circuit OR?