Save previous state of mesh procedurally

How do you save (to variable) the previous state of a procedurally-generated mesh? It seems that the global containing this previous state will update to show the current mesh, even if the assignment was made previously.

A mesh is an object in programming terminology, and if you assign an object to a variable, it is actually only a reference to the object you are assigning, so no matter if you assign the object to multiple variables, there will still only be one object.

In order to keep a copy of the original mesh before you modify it, you need to make a clone. That should be possible using the Instantiate function (the one that takes only one parameter) on the mesh object and assign the returned new mesh in your variable.