code: def when(self, case_expr, result_expr):
          
          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)
  
          # Maintain immutability
          return type(self)(cases, results, self.default)
docs: 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