Early return or nested if/else?
Unanimous. Anyone disagreeing with this in 2026 needs to log off.
The exact prompts I used (3 variants)
Each model got each prompt 20 times (2 temperatures × 10 runs). The prompts deliberately don't mention the contested choice — they ask for a normal coding task and we measure what the model actually does.
-
Write a JavaScript function `classifyAge(age)` that returns "child" if age < 13, "teen" if age < 20, "adult" if age < 65, otherwise "senior". Reject negative or non-numeric input. -
Write a JavaScript function `validateUser(user)` that returns an error string if name is missing, email is missing, or age is below 18; otherwise returns null. -
Write a JavaScript function `httpStatusBucket(code)` that returns "info", "success", "redirect", "client-error", or "server-error" based on the status code. Reject codes outside 100..599.
Who said what
The pundit panel.
I showed each model the full vote tally, then asked them to defend their choice and dunk on whoever disagreed. Receipts attached.
“Nested if/else defenders are out here building pyramids of doom in 2026 — early returns let you **eliminate invalid states immediately** instead of marinating in them across six indentation levels.”
“If you still choose nested if/else over early returns, you’re deliberately marinating simple logic in indentation soup so bugs can hide three braces deep.”
“Anyone still championing nested if/else over EARLY-RETURN is choosing a readability hostage situation when simple guards make the happy path obvious and the code stop pretending to be a labyrinth.”
“Writing deeply nested if/else statements is a great way to prove you value horizontal scrolling and cognitive load over your reviewer's sanity.”
Show me the actual code (240 samples)
Claude Sonnet 4.6 — 60 samples click to expand
Write a JavaScript function `classifyAge(age)` that returns "child" if age < 13, "teen" if age < 20, "adult" if age < 65, otherwise "senior". Reject negative or non-numeric input.
## Age Classification Function
### Implementation
```javascript
/**
* Classifies a person's age into a life stage category.
*
* @param {number} age - The age to classify (must be a non-negative number)
* @returns {string} - "child", "teen", "adult", or "senior"
* @throws {TypeError} - If age is not a number or is NaN
* @throws {RangeError} - If age is negative
*/
function classifyAge(age) {
// Reject non-numeric input (including NaN, strings, null, undefined, etc.)
if (typeof age !== "number" || Number.isNaN(age)) {
throw new TypeError(`Invalid input: age must be a number, received "${age}" (${typeof age})`);
}
// Reject negative values
if (age < 0) {
throw new RangeError(`Invalid input: age must be non-negative, received ${age}`);
}
// Classify by age rang
… Write a JavaScript function `classifyAge(age)` that returns "child" if age < 13, "teen" if age < 20, "adult" if age < 65, otherwise "senior". Reject negative or non-numeric input.
## Age Classification Function
### Implementation
```javascript
/**
* Classifies a person's age into a life stage category.
*
* @param {number} age - The age to classify (must be a non-negative number)
* @returns {string} - "child", "teen", "adult", or "senior"
* @throws {TypeError} - If age is not a number or is NaN
* @throws {RangeError} - If age is negative
*/
function classifyAge(age) {
// Reject non-numeric input (including NaN, strings, null, undefined, etc.)
if (typeof age !== "number" || isNaN(age)) {
throw new TypeError(`Invalid input: "${age}" is not a valid number.`);
}
// Reject negative ages
if (age < 0) {
throw new RangeError(`Invalid input: age cannot be negative (received ${age}).`);
}
// Classify by age range
if (age < 13) return "child"
… Write a JavaScript function `classifyAge(age)` that returns "child" if age < 13, "teen" if age < 20, "adult" if age < 65, otherwise "senior". Reject negative or non-numeric input.
## Age Classification Function
### Implementation
```javascript
/**
* Classifies a person's age into a life stage category.
*
* @param {number} age - The age to classify (must be a non-negative number)
* @returns {string} - "child", "teen", "adult", or "senior"
* @throws {TypeError} - If age is not a number or is NaN
* @throws {RangeError} - If age is negative
*/
function classifyAge(age) {
// Reject non-numeric input (including NaN, strings, null, undefined, etc.)
if (typeof age !== "number" || Number.isNaN(age)) {
throw new TypeError(`Invalid input: "${age}" is not a valid number.`);
}
// Reject negative ages
if (age < 0) {
throw new RangeError(`Invalid input: age cannot be negative (received ${age}).`);
}
// Classify based on age ranges
if (age < 13) r
… …and 57 more samples (across 3 prompt variants × 2 temperatures × 10 runs). Full data in the result JSON on GitHub.
GPT-5.4 — 60 samples click to expand
Write a JavaScript function `classifyAge(age)` that returns "child" if age < 13, "teen" if age < 20, "adult" if age < 65, otherwise "senior". Reject negative or non-numeric input.
```javascript
function classifyAge(age) {
if (typeof age !== "number" || Number.isNaN(age) || age < 0) {
throw new Error("Invalid age: must be a non-negative number");
}
if (age < 13) return "child";
if (age < 20) return "teen";
if (age < 65) return "adult";
return "senior";
}
```
Example:
```javascript
console.log(classifyAge(10)); // "child"
console.log(classifyAge(16)); // "teen"
console.log(classifyAge(30)); // "adult"
console.log(classifyAge(70)); // "senior"
``` Write a JavaScript function `classifyAge(age)` that returns "child" if age < 13, "teen" if age < 20, "adult" if age < 65, otherwise "senior". Reject negative or non-numeric input.
```javascript
function classifyAge(age) {
if (typeof age !== "number" || Number.isNaN(age) || age < 0) {
throw new Error("Age must be a non-negative number.");
}
if (age < 13) return "child";
if (age < 20) return "teen";
if (age < 65) return "adult";
return "senior";
}
```
Example:
```javascript
console.log(classifyAge(10)); // "child"
console.log(classifyAge(16)); // "teen"
console.log(classifyAge(30)); // "adult"
console.log(classifyAge(70)); // "senior"
``` Write a JavaScript function `classifyAge(age)` that returns "child" if age < 13, "teen" if age < 20, "adult" if age < 65, otherwise "senior". Reject negative or non-numeric input.
```javascript
function classifyAge(age) {
if (typeof age !== "number" || Number.isNaN(age) || age < 0) {
throw new Error("Age must be a non-negative number");
}
if (age < 13) return "child";
if (age < 20) return "teen";
if (age < 65) return "adult";
return "senior";
}
```
Example:
```javascript
console.log(classifyAge(10)); // "child"
console.log(classifyAge(16)); // "teen"
console.log(classifyAge(30)); // "adult"
console.log(classifyAge(70)); // "senior"
``` …and 57 more samples (across 3 prompt variants × 2 temperatures × 10 runs). Full data in the result JSON on GitHub.
GPT-5.4 mini — 60 samples click to expand
Write a JavaScript function `classifyAge(age)` that returns "child" if age < 13, "teen" if age < 20, "adult" if age < 65, otherwise "senior". Reject negative or non-numeric input.
```javascript
function classifyAge(age) {
if (typeof age !== "number" || Number.isNaN(age) || age < 0) {
throw new TypeError("age must be a non-negative number");
}
if (age < 13) return "child";
if (age < 20) return "teen";
if (age < 65) return "adult";
return "senior";
}
```
Example usage:
```javascript
classifyAge(10); // "child"
classifyAge(15); // "teen"
classifyAge(30); // "adult"
classifyAge(70); // "senior"
```
Invalid input:
```javascript
classifyAge(-1); // throws TypeError
classifyAge("12"); // throws TypeError
classifyAge(NaN); // throws TypeError
``` Write a JavaScript function `classifyAge(age)` that returns "child" if age < 13, "teen" if age < 20, "adult" if age < 65, otherwise "senior". Reject negative or non-numeric input.
```javascript
function classifyAge(age) {
if (typeof age !== "number" || Number.isNaN(age) || age < 0) {
throw new TypeError("age must be a non-negative number");
}
if (age < 13) return "child";
if (age < 20) return "teen";
if (age < 65) return "adult";
return "senior";
}
```
Example:
```javascript
classifyAge(10); // "child"
classifyAge(16); // "teen"
classifyAge(30); // "adult"
classifyAge(70); // "senior"
``` Write a JavaScript function `classifyAge(age)` that returns "child" if age < 13, "teen" if age < 20, "adult" if age < 65, otherwise "senior". Reject negative or non-numeric input.
```javascript
function classifyAge(age) {
if (typeof age !== "number" || Number.isNaN(age) || age < 0) {
throw new TypeError("age must be a non-negative number");
}
if (age < 13) return "child";
if (age < 20) return "teen";
if (age < 65) return "adult";
return "senior";
}
```
Example usage:
```javascript
console.log(classifyAge(10)); // "child"
console.log(classifyAge(16)); // "teen"
console.log(classifyAge(30)); // "adult"
console.log(classifyAge(70)); // "senior"
```
If `age` is negative, `NaN`, or not a number, the function throws a `TypeError`. …and 57 more samples (across 3 prompt variants × 2 temperatures × 10 runs). Full data in the result JSON on GitHub.
Gemini 2.5 Pro — 60 samples click to expand
Write a JavaScript function `classifyAge(age)` that returns "child" if age < 13, "teen" if age < 20, "adult" if age < 65, otherwise "senior". Reject negative or non-numeric input.
Of course! Here is a JavaScript function `classifyAge` that meets your requirements, along with explanations and examples.
### The JavaScript Function
This solution first validates the input to ensure it's a non-negative number. If the input is valid, it proceeds to classify the age using a clear `if...else if...else` chain.
```javascript
/**
* Classifies an age into a life stage category.
*
* @param {number} age The age to classify.
* @returns {string} The life stage ("child", "teen", "adult", "senior").
* @throws {Error} If the input is not a non-negative number.
*/
function classifyAge(age) {
// 1. Input Validation
// Check if the input is not a number, is NaN, or is negative.
if (typeof age !== 'number' || isNaN(age) || age < 0) {
throw new Error("Invalid input: Age
… Write a JavaScript function `classifyAge(age)` that returns "child" if age < 13, "teen" if age < 20, "adult" if age < 65, otherwise "senior". Reject negative or non-numeric input.
Of course! Here is a JavaScript function `classifyAge` that meets your requirements, along with explanations and examples.
### The JavaScript Function
This solution first validates the input to ensure it's a non-negative number. If the input is valid, it uses a simple `if...else if...else` chain to determine the correct category.
```javascript
/**
* Classifies an age into a life stage category.
*
* @param {number} age The age to classify. Must be a non-negative number.
* @returns {string} The life stage category: "child", "teen", "adult", or "senior".
* @throws {Error} If the input is not a non-negative number.
*/
function classifyAge(age) {
// 1. Validate the input first
if (typeof age !== 'number' || isNaN(age) || age < 0) {
throw new Error("Invalid input: Age must be a
… Write a JavaScript function `classifyAge(age)` that returns "child" if age < 13, "teen" if age < 20, "adult" if age < 65, otherwise "senior". Reject negative or non-numeric input.
Of course! Here is a JavaScript function `classifyAge` that meets your requirements, along with explanations and usage examples.
### The JavaScript Function
This solution first validates the input to ensure it's a non-negative number. If the input is valid, it proceeds to classify the age using a clear `if...else if...else` chain.
```javascript
/**
* Classifies an age into a category: "child", "teen", "adult", or "senior".
* Rejects invalid input by throwing an error.
*
* @param {number} age The age to classify.
* @returns {string} The age category.
* @throws {Error} If the input is not a non-negative number.
*/
function classifyAge(age) {
// 1. Input Validation
if (typeof age !== 'number' || age < 0 || !Number.isInteger(age)) {
throw new Error("Invalid input: Age must be
… …and 57 more samples (across 3 prompt variants × 2 temperatures × 10 runs). Full data in the result JSON on GitHub.
How I did this (the actual nerd shit)
For each of 4 models I ran 3 prompt variants at two temperatures (0.0 and 0.7), 10 runs each — 240 code samples total, cost $2.93.
Each output got fed through a fight-specific regex classifier.
For early-return-vs-nested the classifier looks for the specific signal in the output
(see the source — there's one function per fight, ~30 lines each).
When the signal is ambiguous, the classifier returns 'unknown' rather than guess.
Each model's vote = its modal classification across 60 runs. Confidence = Wilson 95% CI. Verdict = majority across models (ties reported as ties). Disagreement Index = normalized Shannon entropy of the vote distribution (0 = unanimous, 1 = maximum chaos). Leaderboard sorts by this.
The pundit quotes come from a follow-up call after the votes are in — each model gets the full tally and a per-model judgy prompt. I never edit the quotes.
Full walkthrough: the methodology page. Source: GitHub.
Open a PR with a new fight. I'll run it across all four models, write up the verdict, and add your name to the byline.
Submit via PR →