Data Types

<< Click to Display Table of Contents >>

Navigation:  Concordance Programming Language Reference >

Data Types

There are five basic data types in the Concordance Programming Language. Their types and limits are listed in the table below:

Type

Value Range

Size

char

-128 to 127

1 byte

text

any null terminated text

variable length

short

-32,768 to 32,767

2 bytes

int

-2,147,483,648 to 2,147,483,647

4 bytes

int64

–9,223,372,036,854,775,808 to 9,223,372,036,854,775,807

8 bytes

float

-2.2E-308 to 1.7E+308

8 bytes

The numeric data types—char, short, int, and float—can be freely assigned to each other and compared with each other. CPL will perform the necessary conversion so that the comparison or assignment is performed correctly.

Text values contain variable length strings. Their values are the values of the entire string. They can be assigned from or compared with character arrays, quoted strings, text or paragraph fields, or themselves. Database text fields, both fixed length and free text, are treated as text variables.

Date values, taken from date fields and functions which return dates, are handled as int types. Date math is performed in increments of days. Adding 5 to a date adds 5 days. Dividing or multiplying dates, while valid with any integer, will produce meaningless results.

 

Arrays

Any data type identifier followed by brackets, [ ], becomes an array. An array is a set of sequentially ordered elements which are accessed by subscripting the array. The first element in an array is element zero, thus an array with 100 elements contains elements 0 through 99.

A special array type is the char array. It can be used to store strings, a sequence of characters. In CPL, all character arrays are terminated by a zero. Character arrays can be assigned a quoted string, assigned the value of other char arrays or text variables, or compared with them. This is the only array type in CPL that allows the direct assignment or comparison of the entire array.

Example:

char today[10];

today = "Tuesday";

/* today[0] is T

today[1] is u

today[2] is e

today[3] is s

today[4] is d

today[5] is a

today[6] is y

today[7] is 0 */