Types

A type defines which values a variable can hold.

Types of types

The array type is in addition to the first four types.

Special Type

  • Void

Boolean type

A variable of boolean type can hold a boolean value, which is either yes or no (often called true and false).

Character type

A variable of character type can hold a single UTF-16 character in the Basic Multilingual Plane (BMP) or one of the 16-bit surrogate code points. Characters outside this is stored as two characters, as a surrogate pair. This means that the numeric range of the character type is 16-bit or 0 – 2^16-1.

Void

The void type is only used to say that a function does not return a value.

Type descriptor

A type descriptor describes a type.

The type descriptor can either be

  • A type name
  • An optional array length

Type name

  • Decimal
  • Boolean
  • Character
  • Itenfifier for a data strucutre

Array

Syntax: []

Variables are declared with unspecified length. The length is accessible using the array length operator documented as a structural operator.

Array length

Syntax: [5], [a], [c+2].

When allocating an array, the length must be given. An array length consists of square brackets with something that results in a value inside. The value can be a decimal literal, a decimal variable or an expression resulting in a decimal value.