Global Variable
The variables are used to store values.
In the case of global variable< i>, it is the whole variable created in the external area of the main program (see image).
This type of variable is recognized at any point in your code, that is,
within any function, you can use this variable as long as no there is no local variable of the same name!
It is recommended that avoid using this type of variable , as this can lead to confusion in the code.
When you create a global variable, you can configure the following characteristics:
- Const: although it has the variable name, when we define a variable to be constant, it can not have its initial value changed;
- Type: defines the type of information that will be stored in the variable (simple types: integer, real, string or logical, vector: any simple type);
- Name: defines the name of the variable, used to trigger it from any part of the program;
- Value: defines a value to be stored in the variable.