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:

  1. Local scope – module
  2. Global scope – env
  3. Static scope – template

Set variable:

Get variable:

 

Template Scope:

Variable access is restricted within the template only, accessible within the template itself.

 

Module Scope:
Access the variable it self module also and in any template of that module, variable is accessible in all the templates of that module.

 

Environment Scope:
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.

 

Categories
Most Popular

Leave a Reply

Your email address will not be published. Required fields are marked *