English (English)


You can create and use variables in any section where code is entered. The name of a variable cannot coincide with the name of a global constant or the name of an element.

Variables can be created in one of two ways.

You can declare a variable by specifying its type and name

The syntax is as follows:

[type name] [variable name];

For example:

Int a;
String s;
Logic isElementLongEnough;

To call the value of a variable, you must first initialize it by using an assignment operator. Calling a variable that has not been initialized will result in an error during compilation or when executing the code.

You can declare a variable and initialize it at the same time.

You can declare and initialize a variable using an expression, e.g. an element name, an element property or another variable. The syntax is as follows:

Let [variable name] = [expression]

For example:

Int a;a=3; Let a1 = a + 5;
Let myElement = SearchObjects.Group1.Group2.FirstItem
Let myRect = SearchObjects.Group1.Group2.FirstItem.Rect

The system creates a variable with the specified name. The type of the variable is implicitly defined by the type of the expression it refers to. At the same time the variable is initialized using the value of the expression.

Variables created using this method can be conveniently used as shortcut names for deeply nested elements and other objects to make the notation shorter.

12.04.2024 18:16:02

Please leave your feedback about this article

Usage of Cookies. In order to optimize the website functionality and improve your online experience ABBYY uses cookies. You agree to the usage of cookies when you continue using this site. Further details can be found in our Privacy Notice.