using a switch case with a 5-position switch and serial output
When you want to perform actions in response to button presses, you
should take care of reacting to the signal edges rather than levels.
In other words, you perform the action only when the signal changes from
LOW to HIGH, not every time you see it HIGH.
You should also read about button bounce, and either implement your own
debouncing or use an existing library. Below is an example using
Bounce2, but there are other options:
#include &lt;Bounce2.h&gt;

const uint8_t pinDim    = 3;
const uint8_t pinMedium = 4;
const uint8_t pinBright = 5;

Bounce buttonDim, buttonMedium, buttonBright;

void setup() {
    buttonDim.attach(pinDim, INPUT);
    buttonMedium.attach(pinMedium, INPUT);
    buttonBright.attach(pinBright, INPUT);
}

void loop() {
    buttonDim.update();
    buttonMedium.update();
    buttonBright.update();

    if (buttonDim.rose()) {
        Serial.println(&quot;dim&quot;);
    }
    if (buttonMedium.rose()) {
        Serial.println(&quot;Medium&quot;);
    }
    if (buttonBright.rose()) {
        Serial.println(&quot;bright&quot;);
    }
}

You could also, as suggested in Michel Keijzers' answer, use arrays for
the pins and Bounce objects. While these would help streamline the
calls to attach() and update(), they will not help with the meaty
part of the code, i.e. reacting to the presses. There, I would prefer
the button to have descriptive names.