
Finally is always executed no matter what happens beforehand. For example if there is an if-loop it either executes if or else, then it executes finally, no matter the previous outcome.
A finally statement could be used, for example like this: Here we send an email when an error occurs, and creates and executes a file when it succeeds. Finally reboots the device, no matter if there occured an error or not.

The next example automation patches the devices. If a patch takes too long on a device and is therefore cancelled, finally makes sure the reboot is still being done afterwards. Finally always happens, even when the runtime is out.

