Case Function

$Case (or $Switch) calculates expression and uses it as the selector to find depended value by the label. The function has following parameters:

  1. Selector expression - the program will use it to find required pair
  2. Pair1 definition
  3. PairN definition
  4. (optional) default value. It will be used if no label found

The pair definition is: <label>:<pattern>, for example: 5:five or 3:$Rint(0,100)


  1. $Case(5,1:one,2:two,3:three,4:four,5:$Rint(0,5)) - random number between 0 and 5 will be generated
  2. $Case(0,1:one,2:two,3:three,4:four,5:five,other) - 'other' will be generated
  3. $Case(@'F1',1:one,2:two,3:three,4:four,5:five,other) - uses F1 column as value of the selector expression