06 Jan 2023 (in calibre 6.12):
- New function switch_if()
Code:
switch_if([test_expression, value_expression,]+ else_expression)
For each "test_expression, value_expression" pair, checks if test_expression is True (non-empty) and if so returns the result of value_expression. If no test_expression is True then the result of else_expression is returned. You can have as many "test_expression, value_expression" pairs as you want.