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>:<value>, for example: 5:five

Examples

  • $Case(5,1:one,2:two,3:three,4:four,5:five) - 'five' will be generated
  • $Case(0,1:one,2:two,3:three,4:four,5:five,unknown) - 'unknown' will be generated
  • $Case(@'F1',1:one,2:two,3:three,4:four,5:five,unknown) - uses F1 column as value of the selector expression