Declarations

The following rules apply to 4Test declarations:
Scoping Rules
Scope applies to the declarations of constants, variables, data types, functions, windows, and window classes. The scope of a declaration is either public or private:
  • A private declaration is available only in the file where it is declared.

  • A public declaration is available in any file that accesses it through a use statement.

Note: You can specify the scope of a declaration only if the declaration is global, not if it appears within a function, window, or winclass declaration.
Constant Declarations

You can use a constant to represent a fixed value. There are several types of constants. Some examples include integer, floating-point, string, and boolean.

To declare constants, use the const statement. For a summary of the constants provided in Silk Test Classic, see Built-in Constants.

Variable Declarations
For information on declaring variables using 4Test, see the following:
  • ARRAY Data Type
  • LIST Data Type
  • Variable Declaration
Data Type Declarations

You can define three kinds of data types.

Alias An alias data type is a new name for an existing type or declares variables that can be assigned values of more than one type (called overloading). Use the type ... is declaration to declare alias data types.
Enumerated An enumerated data type groups together a set of values and orders them sequentially from 1 to n. You declare an enumerated type when you want a variable to hold only a limited number of distinct values. Use the type ... is enum declaration to declare enumerated data types.
Record A record groups a fixed number of randomly accessible items of different types. The fields in a record can each have a different data type. Use the type ... is record declaration to declare record data types.
Function Declarations
For information on declaring functions, see Function declaration.
Window Declarations

You can declare new windows using the window declaration keyword. Within the window declaration you can define the methods and properties that are associated with this window.

Winclass Declarations
You can also declare new window classes using the winclass declaration keyword. Within the window class declaration you can define the methods and properties that are associated with this class.