Using IF statement with 2 LEDs

I connected longer part of the LED to a resistor, then the pin, and the shorter part to the ground. The rework still has the same problem. Thanks for helping out btw.