How to keep something on until?

SEBA11:
No how to keep pin, on until something is true

Turn it on with digitalWrite(pin, HIGH);

Then regularly check the something using something like value = digitalRead(somethingPin);

When the something is true, turn it off using something like

if (value == true) {
   digitalWrite(pin, LOW);
}

...R