@mmcdara I didn't suggest that you would remove the global declaration inside your procedures. But it's not necessary at the top level. That is all.
You have shown one possible edit to the code, to initialize G:= inside the outer procedure. Fine.
But it's not the only way to edit the original.
You could also have kept the G:= done at the top level just before calling `Main` (or `f` in your followup) while deleting the problematic top level global declaration statement. That is the shortest edit to the original.  I showed this very idea, with code, in my Answer.
There are also ways to access and assign to global G from within the procedures -- even if they don't have their own `global` declarations. But I'll leave those aside as they are not simpler.
As an aside, personally I think changing globals from with procs is generally inferior namespace management. A modern alternative is to have Main be an appliable module which stores its own module-local G and provides an accessing export for getting G's value from outside Main.