Documentation / Tutorials / Quick Samples
Samples for Variable Scope (template, module, environment)
/ Quick Samples / Samples for Variable Scope (template, module, environment)
The scope of a variable is defined it’s range in the program under which it can be accessed. The scope of a variable is the portion of the program within which it is defined and can be accessed.”
AW has three types of variable scopes:
- Local scope – module
- Global scope – env
- Static scope – template
Variable access is restricted within the template only, accessible within the template itself.
Access the variable it self module also and in any template of that module, variable is accessible in all the templates of that module.
Initialize the variable and access anywhere wherever you need it. Within template or any other module or set it in the module and access in another service, everywhere it is accessible.
Access a value from one module to any other, use the env scope and access the value.