And because you made it just an input and not connect it it's floating. A pin that's not connected does not mean it's low, it's like undefined, it can be high or low. To overcome that, use pinMode(readPin, INPUT_PULLUP). This will pull a pin high when it's not connected. So connect the pin to GND to make it switch
void setup() {
pinMode (11, OUTPUT); // Yellow
pinMode (8, INPUT); //jumper to GND
pinMode (12, OUTPUT); // Red
pinMode(8, INPUT_PULLUP); //Thanks for the tip
}
void loop(){
if (digitalRead (8)==HIGH) // jumper not connected to GND
{
digitalWrite (11, HIGH);// Yellow LED on
digitalWrite (12, LOW) ;//Red LED off
}
else
{
digitalWrite (12, HIGH);// Red LED on
digitalWrite (11, LOW);//Yellow LED off
}