If you want to input a manual switch signal into a digital circuit you'll need to debounce the signal so a single press doesn't appear like multiple presses.
- You are unlikely to enable the internal pull-up resistor on switch pins, therefore each switch require an external pull-up resistor
- It is not possible to detect the switch state before main loop (setup). When you press a switch during power on, you will never get the state of the switch.
I'm modifying the example code, it is useful if you want something to only happen once when a button is pressed.