global tag works almost the same as assign tag. The difference is scope of the variable created with both tags.

If a task uses multiple hooks, defining variable with assign, won't make it accessible in following hooks. Instead we can use global. Any variable defined with this tag will be accessible in each hook that follows the definition.