Class classifier overview

The Class classifier is the basis of the ANY type, List types and Dictionary type, all of which are reference types. You cannot use the Class classifier to define custom types.

The following sections further describe the types.

ANY

A field of type ANY can reference an instance of any type. For example, if you assign the value 5 to the field, the field is referencing an instance of type INT. If you then assign the value “yes!," a new memory area is assigned the value, and the field references that area, which is of type STRING.

One purpose of a field of type ANY is to store different types of values in a single dictionary or list.

List types

An instance of a List type includes an ordered sequence of elements, and you can increase or decrease the number of those elements at run time.

The following code initializes named lists with literal values:
myINTList     INT[] = [1,2,3];
mySTRINGList  STRING[] = ["bye", "ciao"];
myBooleanList BOOLEAN[] = [ (10000 > 50000), (10000 < 50000) ];   
my2Dimension  INT[][] = [[1,2],[3,4]];
Each variable is not of type List, but of type xyz List or xyz[], where xyz is the type that is specified in the variable declaration. The xyz List and xyz[] usages are equivalent. Here are details on the example:
  • myIntList is a variable of type INT List or INT[]. The second element is of type INT and contains the value 2.
  • mySTRINGList is a variable of type STRING list or STRING[]. Its second element is of type STRING and contains the value “ciao”.
  • myBooleanList is a variable of type BOOLEAN list or BOOLEAN[]. Its second element is of type BOOLEAN and contains the value TRUE.
  • my2Dimension is a two-dimension list; it is of type INT[][]. The second element is of type INT[] and references the list [3, 4]. The second element of that second list is of type INT and contains the value 4.
In each case, your code identifies the specific element by a list name and an index; for example:
  • The second element of myIntList is myIntList[2].
  • The second element of my2Dimension is my2Dimension[2].
  • The second element of my2Dimension[2] is my2Dimension[2][2].

This usage shows that a type can be the basis of an unnamed instance. Such an instance can be referenced only by use of an index.

Dictionary type

Here is a declaration of a dictionary, which is an instance that is based on the Dictionary type:
myDictionary Dictionary
{
   driverID  = myInteger,
   lastName  = "Twain",
   firstName = "Mark"
	};

As shown, a dictionary is composed of a set of entries, each of which is a key and related value. You can read, update, and delete the key-value pairs at run time and can add new ones. A later section gives further details.

When you add a variable such as myInteger to a dictionary, you add a copy of the variable. Changes to the variable outside the dictionary do not change the value of the related entry in the dictionary.

By default, a dictionary is not case sensitive: driverID is the same as DRiverID