Global Variables
- Updated2025-10-31
- 2 minute(s) read
Use the section globals code block to define PAscript global variables that correspond to variable names in your tests.
Use the following syntax to define variables:
type PAtoolsVariable_1, ... , PAtoolsVariable_n
The variables (PAtoolsVariable_1, ... , PAtoolsVariable_n) must match the variable names that you use in your test.
Use one of the following simple data types as the type:
In addition to the simple data types, corresponding data types for various other PAtools types are available in PAscript. Refer to Data Types for information about other PAscript data types.
The section globals code block is closed with an endsection keyword.
- The section globals code block is optional in a PAscript program. You can omit the section globals code block from the test if you do not require global variables.
- In a PAscript program, there can be only one section globals code block.
- Create global variables with copy and paste. You can also use drag and drop to create global variables.
- You are not required to specify dimensions in texts, value tables, and buffers. The dimensions are derived from the definition in the test.
- You can add descriptions to the right of each variable definition using comment notation of // or /* ... */. The editor displays the description when you toggle over a variable.
- You cannot use histories, measurements, or DSO in PAscript.
- You cannot assign an initialization value to global variables in PAscript. Global variables contain their current values from the test execution at the time you call the PAscript program.
Example: Global Variables
program
section globals
int32 a, b
int32 c /* comment description for variable c */
real64 d // comment description for variable d
pabasic pabasicProgram
endsection
endprogram
Related Information
- Data Types
Learn about data types in PAscript.