Skip to main content

Option and Result cards

Recall when to use Option, Result, and exceptions for expected and unexpected failures.

functional-programming4 min read

Option vs Result: what is the decision rule? Compare Use Option for expected absence when no reason is needed; use Result when the caller must act on a specific failure reason. Choose from the caller's next action, not from personal style. Objection: "Why not return null and keep it simple?" Use this when a missing value is crossing a module or API boundary. Null makes each caller rediscover absence rules; Option makes expected absence explicit and forces a visible branch. Your line Null makes every caller rediscover the rule. Option tells the caller absence is expected and forces a visible…

Read the full lesson

Sign up free: one personalized lesson every day, matched to your role and goals.

← Back to library

Contact us