---
title: "Discussion on \"Code Smell 156 - Implicit Else\" | Hashnode"
description: "Discussion on \"Code Smell 156 - Implicit Else\". We learn if/else on our first programming day. Then we forget the else"
url: "https://hashnode.com/posts/code-smell-156-implicit-else/62eea0e4ba649046e8d8dbfa"
---

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

Discussion

# [Code Smell 156 - Implicit Else](https://maximilianocontieri.com/code-smell-156-implicit-else?utm_source=hashnode&utm_medium=feed)

We learn if/else on our first programming day. Then we forget the else

Aug 6, 2022 · 2 min read · maximilianocontieri.com  
Read the article

-   [#programming](https://hashnode.com/tag/programming)
-   [#clean-code](https://hashnode.com/tag/clean-code)
-   [#software-development](https://hashnode.com/tag/software-development)
-   [#refactoring](https://hashnode.com/tag/refactoring)
-   [#programming-blogs](https://hashnode.com/tag/programming-blogs)

## Written by

[Maxi Contieri](https://hashnode.com/@mcsee)

@mcsee · Buenos Aires

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

Software Engineer

I’m a senior software engineer loving clean code, and declarative designs. S.O.L.I.D. and agile methodologies fan.

## Responses 1

Markdown supported · ⌘↵ to post

[Markos Korvesis](https://hashnode.com/@MarkosK)

[Aug 18, 2022](https://hashnode.com/posts/code-smell-156-implicit-else/62eea0e4ba649046e8d8dbfa/comment/62fea7bff1a220fcdbb6553d)

Hey [Maxi Contieri](https://hashnode.com/@mcsee), good article!

I feel, however, that the wrong vs. right cases you provided are not comparable with each other. The "wrong" example is an if/else and the "right" one is an if/else-if/else.

Implicit "else" seems fine to me when the "if" body is surrounded by curly braces, if not then I'd prefer a ternary return assuming there would only ever be two cases.

From my point of view, the most important takeaway is the suggestion to give up on the if/else\* block altogether and replace it with polymorphism.
