This code is just a test to find out what is happening o my main code.
Button is set on pin 5, pin 5 os set as INPUT.
LED is set on pin 13 (built in led) pin 13 is set as OUTPUT.
The circuit in post#1 is not inherently wrong, but there is a risk of short circuiting +5V and GND.
Advice: omit the +5V line and use the internal pull up resistor - pinMode(pin, INPUT_PULLUP) - simpler circuit AND less risk.
Mind that the value is inverted.