Skip to main content
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:
For example:
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:
For example:
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.