# If statement does not work in Switch case

**URL:** <https://forum.arduino.cc/t/if-statement-does-not-work-in-switch-case/864610>\
**Category:** General Guidance\
**Created:** [May 21, 2021, 3:27am UTC](https://forum.arduino.cc/t/if-statement-does-not-work-in-switch-case/864610 "2021-05-21T03:27:50Z")\
**Posts on this page:** 1\
**Showing post:** 17

<div class="post-metadata">

**Author:** ![johnerrington](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/johnerrington/32/340106_2.png) [@johnerrington](https://forum.arduino.cc/u/johnerrington)\
**Post date:** [May 21, 2021, 4:40am UTC](https://forum.arduino.cc/t/if-statement-does-not-work-in-switch-case/864610/17 "2021-05-21T04:40:18Z")

</div>

This may help:

> [@Beginners: using the switch - case statement](https://forum.arduino.cc/t/beginners-using-the-switch-case-statement/680177/7):
>
> Hii, This approach looks good and can I know whether the implementation of this code with other Arduino boards effects anything.

I can see why you want to use the switch-case structure, as you have lots of different modes.

I'd recommend you break your code up into functional modules, eg

```arduino
void countPushup()
{
    a ++; //print a point if a pushup has been done
    Serial.println(a);
    BT.println("Push-Up");
    BT.println("Counts:");
    BT.println(a);
    lcd.clear();
    lcd.setCursor(3,0);
    lcd.print("Push-Up");
    lcd.setCursor(3,1);
    lcd.print("Counts: ");
    lcd.setCursor(10,1);
    lcd.print(a);
    yellow_blink(); 
  }

```

---

_[View the full topic](https://forum.arduino.cc/t/if-statement-does-not-work-in-switch-case/864610)._
