If you do an edit by mistake, like erasing a big part of the program, you can always undo the change by pressing CTRL – Z on the keyboard. In addition to undoing changes, you can also redo by pressing CTRL – Y.
Undo and Redo are also available from the Edit menu.