The memento pattern is useful if you need to preserve multiple states of your program or models, which you want to be able to go back or forward to, such as a browsing history or an undo manager.
In this section, we'll implement the memento pattern with a simple example that showcases the different objects required for this pattern.