Circuit:

Any time , the diode conducts. When , the diode is off. stays constant. Basically, will stay at the highest value that it’s seen until it sees a higher value.

We can reset it by adding a switch:

There will be some leakage, so it won’t hold the value perfectly: