global variable
Define a global variable and (optionally) assign a value to it, or assign a value to an existing global variable.
Name | Description | Type | Modifier |
---|---|---|---|
name | Name of the global variable. | String | None |
value | (Optional) Value to assign to the variable. | String | None |
None
This action may be used within the following project items: test modules and user-defined actions.
Action lines
name value
global variable i 5
name value
local variable x 1
 
condition to run
while #x<i
 
name value
local variable y #x * 2
 
text
report #"The value of the local variable y: " & y
 
variable value
set variable x #x + 1
 
end while
Result
- A global variable, subsequent to its declaration, is visible throughout all test modules and invoked actions within one execution run.
- For a given execution of global variable, if name specifies a global variable that already exists, the action merely assigns a new value (in the value argument) to the existing variable.
- Restrictions on usage:
- A variable may not be declared within a use data set block if it has the same name as any of the data set headers.
- Same-named local and global variables may not be declared within the same local variable scope level.
- Use variables within pound sign (#) expressions to access their contained values.