---
title: "Discussion on \"When to invert your if checks\" | Hashnode"
description: "Discussion on \"When to invert your if checks\". It's not uncommon to see code like this:\nif (someCondition is true)\n{\n  // Do a thing\n  // Do more things\n  // do a final thing\n  return result;\n}\nelse\n{\n  return new Failure();\n}\n\nNow most people will be quick to spot that we don't need the else, si..."
url: "https://hashnode.com/posts/when-to-invert-your-if-checks/665a09fb84cc96eee07199c0"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [When to invert your if checks](https://blog.samferree.dev/when-to-invert-your-if-checks?utm_source=hashnode&utm_medium=feed)

It's not uncommon to see code like this: if (someCondition is true) { // Do a thing // Do more things // do a final thing return result; } else { return new Failure(); } Now most people will be quick to spot that we don't need the else, si...

May 31, 2024 · 2 min read · blog.samferree.dev  
Read the article

-   [#csharp](https://hashnode.com/tag/csharp)
-   [#programming-tips](https://hashnode.com/tag/programming-tips)

## Written by

[Sam Ferree](https://hashnode.com/@czechsmix)

@czechsmix · Midwest, US

  
[View profile](https://hashnode.com/@czechsmix)

Blazor, ASP.NET, and Distributed Systems.

Software Architect Specializing in the C# and ASP.NET Core But I've been lucky enough to dabble in Ruby, Python, Node.js, JAVA, C/C++, and more.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
