---
title: "If Condition inside switch case"  
description: "If Condition inside switch case"  
author: "Anonymous User"  
published: 2013-04-06  
updated: 2013-04-06  
canonical: https://www.mindstick.com/forum/725/if-condition-inside-switch-case  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# If Condition inside switch case

Hi Everyone!\
\
I [am trying](https://answers.mindstick.com/qa/36834/which-two-programming-languages-should-i-master-in-if-i-am-trying-to-get-into-google-or-facebook) to [convert](https://www.mindstick.com/forum/2093/configurationmanager-appsettings-convert-n-to-n-why) an [if statement](https://www.mindstick.com/forum/12682/jquery-toggle-if-statement) to [switch](https://www.mindstick.com/blog/104495/switch-bringing-new-advancements-in-the-education-management-system) cases (for readability)\
\
1) I've read switch statements are aweful in general - Is that true? \
\
http://stackoverflow.com/questions/6097513/switch-statement-inside-a-switch-statement-c\
\
2) The statement goes like this:\
\
switch (Show)\
{\
case Display.Expense:\
if (expected.EXPENSE != true)\
break;\
case Display.NonExpense:\
if (expected.EXPENSE == true)\
break;\
case Display.All:\
//[Code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii)\
break;\
}\
[Error](https://yourviews.mindstick.com/view/88527/fixing-quickbooks-error-4120-reinstalling-vs-repairing) is:\
\
[Control](https://www.mindstick.com/blog/197/asp-dot-net-repeater-control) cannot fall through from one case [label](https://www.mindstick.com/articles/12835/print-label-tracking-how-do-these-features-make-auspost-woocommerce-plugin-better) ('case 1:') to another\
\
This is the original if statement:\
\
if ((Show == Display.All) || (expected.EXPENSE == true && Show == Display.Expense) || (expected.EXPENSE == false && Show == Display.NonExpense))\
{\
//Code\
}\
\
[Advance](https://www.mindstick.com/blog/33258/jee-mains-and-jee-advance-exams) Thanks

## Replies

### Reply by AVADHESH PATEL

Hi Jayprakash!\
used switch condition within if statement as below\
switch (Show){ case Display.Expense: if (expected.EXPENSE != true) // do what you want break; else // do what you want break; case Display.NonExpense: if (expected.EXPENSE == true) // do what you want break; else // do what you want break; case Display.All: //Code break;}


---

Original Source: https://www.mindstick.com/forum/725/if-condition-inside-switch-case

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
