Help > UNITS > Defining Data Structures
Defining Data Structures

Rittle enables the creation of more complex data types and data structures called “units”. They can be created by using the words “unit” and “endunit” to enclose one or more variables in a structure that from that moment on, behaves as a single variable. In an example:

unit person;

      var text name;

      var byte age;


This definition creates a data structure called “person” with two fields – for name and for age. Then the structure can be used or assigned to other variables in a normal manner just like other data types:

var person sender, recipient;

will create two record of type “person” and names “sender” and “recipient”.

The individual fields within a definition are accessed through their local names following the name of the definition and a ‘.’ character:



A structure may be formed of lower level structures. For example:


unit mail;

      person sender;

      person recipient;



This definition combines both persons from above into a single record “mail”. Accessing the data fields in this case will follow the levels of the structure. For example: will refer to the text field “name” in sub-definition “sender”.