Turn on lights

In another forum post, one person found this, I made a slight modification.

int on=0;
If(sensor==HIGH) { // this works

~on; // on !=on should work too

digitalWrite(lights, on ? HIGH : LOW);
}

This would be your simple latch.