Next: , Previous: , Up: Built-in functions   [Contents][Index]


7.2.3.24 $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'