> ## 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.

# Name scope

> Name scope in the FlexiLayout language: where variables, constants, and element hypotheses are accessible across Advanced sections and the element tree.

Names of elements, constants and variables can be used only in certain sections of a program. This is called the "scope" of the name. The scope of a variable also determines its lifetime.

The name of a variable declared in the **Region expression**, **Advanced pre-search relations** or **Advanced post-search relations** section is accessible within that section, and only after the point of declaration.

A name declared within a block is accessible only within that block and the blocks enclosed by it, and only after the point of declaration:

```text theme={null}
{
 Int a; a = 5;
}
```

## Access to element hypotheses

Element hypotheses can be accessed through the names of the elements.

The section you are in determines which hypotheses you can access:

| Section                                   | Accessible hypotheses                                                                                                        |
| ----------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| **Advanced pre-search relations**         | Hypotheses for all elements located above the current element in the FlexiLayout tree                                        |
| **Advanced post-search relations**        | Hypotheses for all elements located above the current element, plus the hypothesis formulated for the current element itself |
| **Region expression** (block description) | Hypotheses for all elements located on the "best branch" of the tree of hypotheses                                           |

The code in the **Advanced pre-search relations** section is executed separately for each hypothesis, independently of the hypotheses located on other branches of the tree of hypotheses. This means that when FlexiLayout Studio executes the code of a particular section of an element description, it can access only one hypothesis for each superordinate element, namely the hypothesis located on the same branch.

Element hypotheses and their properties are accessed in read-only mode.

## Full and shortcut element names

Hypotheses for a superordinate element are called by the full name of the element, for example: `SearchObjects.Group1.Group2.FirstItem`. When accessing one subelement of a group from another subelement, you need not specify the name of the group. For example, in the Advanced… sections of the element `SearchObjects.Group1.Group2.SecondItem`, you can call the element `SearchObjects.Group1.Group2.FirstItem` in one of the following ways: `SearchObjects.Group1.Group2.FirstItem`, `Group1.Group2.FirstItem`, `Group2.FirstItem`, `FirstItem`.

The shortcut name will always refer to the most nested element.

Suppose you have the following tree of elements:

```text theme={null}
SearchElements
 FirstItem
 Group1
  FirstItem
  SecondItem
```

If you are in `SearchElements.Group1.SecondItem` and use the name `FirstItem`, you will call the `SearchElements.Group1.FirstItem` element, and not the `SearchElements.FirstItem` element.
