A variable is a named, temporary location in the computer's memory where data is stored. A variable must have a data type, such as long, float, char, word, short, string, or variant. The data type signifies the size and interpretation of the data stored in the variable and what operation can be performed on the data.
Variable naming is similar to Identifier - begin with an underscore (_) or an alphabetic character, and can be followed by any combination of alphabetic characters, numeric characters or underscore (_), use variable naming conventions topic as guidelines to name a variable.
Variables can be declared in the following areas:
● Program, System and Driver modules Variables - These are global variables that normally accessed only from the module where they are declared. If a Driver or a System variable is declared as public the variable can be accessed from another module as well.
● Test Variables - these are program test local variables for use only within the test. When the test starts these variables are created and initialized and when the test ends the variables are destroyed ATEasy 2024 (v13).
● Procedure Variables - these are procedure local variables, they are created and initialized when the procedure is called and destroyed when the procedure is returned. Procedure also has parameters variables that are used to pass data to/from the procedure.
● Form Variables- created when the form is loaded and destroyed when the form object is deleted. If you need to access form members from code that reside outside the form, you must declare the member as Public.
By default, variables are non-public or local. This means that a variable defined in one module is not visible from another module. Hiding variables from another module is generally a good programming practice because code from one module is not able to change the variable values defined in another module.
A variable can be used in several ways when you are writing code. Variables can be used in:
● An assignment statement where you assign a value to a variable and change its value. For example: nStatus=3
● An expression where a variable value is used to calculate another value. For example, '3*lValue+5'.
● As a parameter to a procedure or a function. For example, 'tan(dValue)'.