← Back to Difficulty Selection

Code Review (Warmup): Boolean Flag Arguments

Story

What does sendEmail(user, true) actually do?

Send a welcome email? Skip validation? Run in "special mode"?

Boolean flags hide behavior behind a yes/no switch.

They make functions harder to understand, harder to test and harder to extend without adding even more flags.

Rule of thumb:

If a boolean changes behavior, it probably deserves a separate function.

Next Topic: Deep Nesting (Arrow Code)

Cookies help us track your progress - nothing extra.