---
title: "Discussion on \"Which one to Use Ternary Operator or If-Else Block\" | Hashnode"
description: "Discussion on \"Which one to Use Ternary Operator or If-Else Block\". In Java (or in C programming also), in case if we have to take decision making with two conditions we can take using Ternary operator or If-Else also. Many times people get confused when to use the both. In this article I would like to capture few po..."
url: "https://hashnode.com/posts/which-one-to-use-ternary-operator-or-if-else-block/5fdba963b78ac62dff80a34c"
---

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

Discussion

# [Which one to Use Ternary Operator or If-Else Block](https://heyvp7.hashnode.dev/which-one-to-use-ternary-operator-or-if-else-block?utm_source=hashnode&utm_medium=feed)

In Java (or in C programming also), in case if we have to take decision making with two conditions we can take using Ternary operator or If-Else also. Many times people get confused when to use the both. In this article I would like to capture few po...

Dec 17, 2020 · 2 min read · heyvp7.hashnode.dev  
Read the article

-   [#java](https://hashnode.com/tag/java)

## Written by

[VISWAPRASATH KS](https://hashnode.com/@HeyVP7)

@HeyVP7 · Chennai, India

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

Ignorance is bliss, but not the excuses

Open Source Contributor Loves Developer Education Passionate about Developer Experience; Currently working as Lead Developer at Zoho.

## Responses 1

Markdown supported · ⌘↵ to post

[Josh Martin](https://hashnode.com/@joshmartindev)

[Dec 18, 2020](https://hashnode.com/posts/which-one-to-use-ternary-operator-or-if-else-block/5fdba963b78ac62dff80a34c/comment/5fdbfea9b78ac62dff80a7ea)

I had no idea this was a thing. I can already think of areas I could apply this to and it's so much quicker than an if else!

[VISWAPRASATH KS](https://hashnode.com/@HeyVP7)

[Dec 18, 2020](https://hashnode.com/posts/which-one-to-use-ternary-operator-or-if-else-block/5fdba963b78ac62dff80a34c/comment/5fdbfea9b78ac62dff80a7ea#reply-5fdc0b441485f22e24b32b35)

Was randomly poking one of my friend about this question. And got to learn we miss it so quickly. Few years back I was nudged by my friend by same question. Hope you will remember this article in future while working.
