code: private static void formatElseIfClauseWithDependencies(
        IfThenPair<?> condition, FormattingContext ctx) {
      ctx.append(" else ");
      try (FormattingContext ignored = ctx.enterBlock()) {
        ctx.appendInitialStatements(condition.predicate)
            .append("if (")
            .appendOutputExpression(condition.predicate)
            .append(") ");
  
        // Most enterBlock callers use try-with-resources to automatically close the block,
        // but here, we need to leave the block open so that subsequent `else if` clauses
        // are chained appropriately. The block will be closed by
        // Conditional#doFormatInitialStatements.
        ctx.enterBlock();
        ctx.appendAll(condition.consequent);
      }
    }
docs: When the predicate of an {@code else if} clause is not representable as a single expression, we
  need to conditionally evaluate its initial statements. We do this by opening an {@code else}
  clause, dumping its initial statements there, then opening a nested {@code if} statement where
  the predicate expression and consequent chunk go. Since this opens two blocks while only
  closing one, the caller ({@link CodeChunk#doFormatInitialStatements}) has to remember to close
  the extra block at the end of formatting.