def when(self, case_expr, result_expr):
    '\n        Add a new case-result pair.\n\n        Parameters\n        ----------\n        case : Expr\n          Expression to equality-compare with base expression. Must be\n          comparable with the base.\n        result : Expr\n          Value when the case predicate evaluates to true.\n\n        Returns\n        -------\n        builder : CaseBuilder\n        '
    case_expr = ir.as_value_expr(case_expr)
    result_expr = ir.as_value_expr(result_expr)
    if (not isinstance(case_expr, ir.BooleanValue)):
        raise TypeError(case_expr)
    cases = list(self.cases)
    cases.append(case_expr)
    results = list(self.results)
    results.append(result_expr)
    return type(self)(cases, results, self.default)
Add a new case-result pair.

Parameters
----------
case : Expr
  Expression to equality-compare with base expression. Must be
  comparable with the base.
result : Expr
  Value when the case predicate evaluates to true.

Returns
-------
builder : CaseBuilder
def when(self, case_expr, result_expr):
    '\n        Add a new case-result pair.\n\n        Parameters\n        ----------\n        case : Expr\n          Expression to equality-compare with base expression. Must be\n          comparable with the base.\n        result : Expr\n          Value when the case predicate evaluates to true.\n\n        Returns\n        -------\n        builder : CaseBuilder\n        '
    case_expr = ir.as_value_expr(case_expr)
    result_expr = ir.as_value_expr(result_expr)
    if (not isinstance(case_expr, ir.BooleanValue)):
        raise TypeError(case_expr)
    cases = list(self.cases)
    cases.append(case_expr)
    results = list(self.results)
    results.append(result_expr)
    return type(self)(cases, results, self.default)