---
title: "How to stop using If-else and make your code more readable"
url: https://daily.dev/posts/how-to-stop-using-if-else-and-make-your-code-more-readable-4uaorxjoy
source_url: https://itnext.io/how-to-stop-using-if-else-and-make-your-code-more-readable-9d1cd97c68bf?source=rss----5b301f10ddcd---4
type: article
source: "ITNEXT"
published: 2022-09-14T22:12:06.659Z
updated: 2022-09-14T22:12:06.658Z
tags: ["github"]
reading_time: 3
upvotes: 144
comments: 9
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# How to stop using If-else and make your code more readable

**[ITNEXT](https://daily.dev/sources/itnext)** · 3 min read · 144 upvotes · 9 comments

## Summary

If-else statements can be problematic if not used correctly. They can be difficult to read and can lead to code that is difficult to maintain. When used incorrectly, if- else statements can also lead to errors. The code above won’t work as you expect after debugging hundred times.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://itnext.io/how-to-stop-using-if-else-and-make-your-code-more-readable-9d1cd97c68bf?source=rss----5b301f10ddcd---4>

## Community discussion

Top comments from developers on daily.dev.

**@passagenick66** · 7 upvotes

> Everytime you write an 'if' statement, you should ask yourself -- "Should this result in a new class?"

**@tugrulyildirim** · 5 upvotes

> I think we should code as we wish.

**@safi28** · 0 upvotes

> Love it! In some cases you would need if/else, but if the code gets unreadable, refactor should be considered!

**@jamali\_dornica** · 0 upvotes

> That's great! thank you

**@whoismatt** · 0 upvotes

> Interesting but in some cases if-else is more readable than ternary condition (mainly in js/ts/etc..).

## Similar posts on daily.dev

- [Don’t just attend KubeCon \+ CloudNativeCon, Merge Forward your experience\!](https://daily.dev/posts/don-t-just-attend-kubecon-cloudnativecon-merge-forward-your-experience--l0rpp73x8) · CNCF · 0 upvotes · 0 comments
- [Announcing H2 2026 KCDs](https://daily.dev/posts/announcing-h2-2026-kcds-m96goajm1) · CNCF · 1 upvotes · 0 comments
- [Two months of Open Community Groups](https://daily.dev/posts/two-months-of-open-community-groups-asf52zhbs) · CNCF · 0 upvotes · 0 comments
- [CNCF Unveils Schedule for KubeCon \+ CloudNativeCon Europe 2026](https://daily.dev/posts/cncf-unveils-schedule-for-kubecon-cloudnativecon-europe-2026-ikhcoa5cb) · CNCF · 2 upvotes · 0 comments
- [CNCF Debuts KubeCon \+ CloudNativeCon Japan 2026 Schedule](https://daily.dev/posts/cncf-debuts-kubecon-cloudnativecon-japan-2026-schedule-xp5pyudub) · CNCF · 1 upvotes · 0 comments

---

Tags: [#github](https://daily.dev/tags/github)

[View this post on daily.dev](https://daily.dev/posts/how-to-stop-using-if-else-and-make-your-code-more-readable-4uaorxjoy)
