> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Variables

> Declare and initialize variables in the FlexiLayout language by giving a type and name or with the Let keyword, which infers type from an expression.

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

Variables can be created in one of two ways.

## Declare a variable by specifying its type and name

The syntax is as follows:

```text theme={null}
[type name] [variable name];
```

For example:

```text theme={null}
Int a;
String s;
Logic isElementLongEnough;
```

To use the value of a variable, you must first initialize it with an assignment operator. Calling a variable that has not been initialized will result in an error during compilation or execution.

## Declare and initialize a variable at the same time

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

```text theme={null}
Let [variable name] = [expression]
```

For example:

```text theme={null}
Int a;a=3; Let a1 = a + 5;
Let myElement = SearchObjects.Group1.Group2.FirstItem
Let myRect = SearchObjects.Group1.Group2.FirstItem.Rect
```

FlexiLayout Studio 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 this way serve as convenient shortcut names for deeply nested elements and other objects, making the notation shorter.
