Blind, Braille and Embossing Technologies

This site uses cookies to personalize content and ads, provide social media features and analyze links. By closing this banner or continuing to browse, you consent to their use.
Read the DiGrande.it Cookie Policy

The variables

Variables can be used in the tactile graphics language. Variables shall be declared before the instruction to be used and shall have the following form:

- Label = Value

The literal label identifies the variable. The value is a type of data assigned to it. The data can be numeric (integer or floating point), Boolean (TRUE or FALSE), or string type. The "=" symbol is the assignment operator, i.e. a symbol that the interpreter recognizes when assigning a value to the variable.

For example:

- CoordX = 50

- Name = "Joseph"

Variables contain data to be used in drawing commands. They are used instead of direct values. For example:

- Dot(50,50)

Draw a dot at the x50 y50 coordinate.

- Dot(CoordX,50)

Draw a point at the x50 y50 coordinate using the CoordX variable, instantiated beforehand.

A variable can be reused in all of the following instructions. For example:

- x = 45

- Circle(x,60,30)

- Dot(x,60)

Variable x was used in both Circle and Dot instruction.

- Circle(x,50,30)

- x = 45

- Dot(x,60)

This code generates an error in the Circle instruction because it uses the x variable which is instantiated only in the next line.

The string data must be contained between the quotation marks. For example:

- Name = "Biblos"

Variables that contain a string type can be used as a parameter for instructions that need data of the same type. For example:

- Text(Name,50,60,4)

If you use a string variable as a parameter for an instruction that needs a different type of data, an error is generated. For example:

- x = "abc"

- Dot(x,50)

An error is generated because the variable x is a string containing letters.

A variable can be instantiated with another variable. For example:

- x = 50

- y = x

- Dot(x,y)

A dot is drawn at the x50 y50 coordinate.

A numeric data can also be written in hexadecimal. For example:

- x = #2a

The "#" symbol is always placed in front of a hexadecimal number. The variable x will be instantiated with the decimal value 42, that is with the hexadecimal number 2a.

A numeric data type can also be floating-point. To specify the decimal part of the number, always use the "." symbol. For example:

- x = 10.5

Two or more strings, either direct or as variables, can be linked together. The plus symbol "+" is used to chain strings. For example:

- FirstName = "Joseph"

- LastName = "Di Grande"

- Full = FirstName+" "+LastName

The concatenation can also be done in the parameter of an instruction. For example:

- Text(FirstName+" "+LastName,50,50,4)

The variables instantiated in the body of the graph are called global variables. Variables instantiated in the body of a procedure are called local variables. Global variables can be used in the main body of the graph and in all procedures. Local variables can only be used within the procedures where they are instantiated. A local variable cannot have the same name as a global variable, because the global variable is always used.