CASE expression :WHEN value OR WHEN value THENblock statementOTHERWISEblock statementEND CASEThe expression that determines which branch of code to execute. The expression parameter can be any valid ABL expression. It can include comparisons, logical operations, and parentheses.Each value is an expression that evaluates to a possible value for expression. If value matches the current value of expression, then the associated block or statement executes.Introduces a block or statement to execute when the value of expression does not match any value in any of the WHEN clauses.END CASE
Each value must have the same data type as expression. If the data types do not match, the compiler reports an error.
When a CASE statement is executed, the AVM evaluates expression and evaluates each value for each branch in order of occurrence until it finds the first value that satisfies the condition. At that point the AVM executes that branch and does not evaluate any other value for that branch or any other branches. If no matching value is found, then the OTHERWISE branch is executed, if given. If the OTHERWISE branch is not given and no matching value is found, then no branch of the CASE statement is executed and execution continues with the statement after the CASE statement.
© 2013 Progress Software Corporation and/or its subsidiaries or affiliates. |