Constant data arrays are data pieces embedded directly into the program code so they can be always available to the program. They also occupy almost no memory in the RAM thus leaving more for actual data.

Data constants are defined in a way somewhat similar to variables but much simpler:


data type name   =   value,;


The only required information for the definition is the data type and the name of the data constant. The compilator does the rest by automatically sizing the array according to the number of following values.

The initialisation part after the ‘=’ sign, is mandatory.

Once defined, a constant data array is accessible in the same way as a one-dimensional array from variables of the defined type. And again, like all arrays in Rittle, indexes always start from 0.

Constant data arrays are read-only. Writing is not permitted. An attempt to do so will generate a program execution error.


data text days = “Monday”, “Tuesday”, “Wednesday”, “Thursday”, “Friday”, “Saturday”, “Sunday”;

This example will create a constant data array of text type with name “days”, and it will contain the names of all days in the week. Accessing element [0] for instance, will return “Monday”, element [5] will return “Saturday”, etc.

Another example:

data byte month_days = 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31;

This constant data array defines 12 elements with the number of days for every month in a year. Accessing “month_days[4]” will return 31 (the number of days in May), etc.

By using the type “any” constant data arrays can be made of mixed type. They can be read out in dedicated variables of the specified type, or in a variable of type “any”, and then processed further with the help of the function type():

data any people = “Annie”, 24, “Michael”, 46, “William”, 51, “Catherine”, 39;

var any temp;

var int index=0;

while index < count(@people[]);

temp = people[index++];

            if type(temp)==30;            ‘ the name of the person

                        print “Name: “,temp,”_r_n”;

            else;                                       ‘ the age of the person

                        print “Age: “,temp,”_r_n”;




It is important to point out that constant data arrays can only be built from single data type constants but not from units.