https://en.wikipedia.org/wiki/Baker_clamp
Flyback diode:
https://en.wikipedia.org/wiki/Flyback_diode
A diode can switch off an AC source when a battery is present: see second circuit in accepted answer, introduced by, "Alternatively, you can probably get away with just using some schottky diodes:"
https://electronics.stackexchange.com/questions/71753/whats-...
Also, diodes can be used to provide a controlled discharge path for capacitors when a device is turned off.
The circuit in this EE StackExchange question shows it:
https://electronics.stackexchange.com/questions/471285/capac...
It has one RC constant when charging and a different RC constant when discharging through the diode.
Why would you want to charge a capacitor slowly when power is applied to the device, but discharge it fast when power is cut? There are various applications for that.
For instance, circuits that control some timed behavior, like holding a CPU chip in a reset state at start up while power stabilizes, and then releasing it. You want that circuit to reset itself quickly if power is lost.
Analog circuits have things like that in them: for instance circuits that mute an audio amplifier on power up for a bunch of milliseconds until a capacitor charges. If the power is cycled, you want that timer to reset itself.
Another application: Log amp: https://en.wikipedia.org/wiki/Log_amplifier
This exploits the diode's characteristic V-I exponential curve in amplifier feedback to produce output proportional to the logarithm of the input.