Node: $IFCASE, Next: , Previous: $IF, Up: Built-in functions



$IFCASE: n-way conditional

This primitive built-in behaves like TeX's \ifcase command. The syntax is

     $IFCASE(expr, case-0, case-1, ...,case-n-1, default)
     

If expr reduces to an integer between 0 and n-1, inclusively, the appropriate case is selected; otherwise, the default case is selected.

As examples,

     $IFCASE(2, zero, one, two, default) => `two'
     $IFCASE(2, zero, one, three) => `three'
     $IFCASE(2, zero, one) => `one'