Expression lists in WHEN

2007-10-30
2012-08-14
  • 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" /
    Select
    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"
    Otherwise
    Say "Out of Range"
    End

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

     
    • Hagrinas
      Hagrinas
      2008-10-28

      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?

      Moritz