From Clomosy Docs
The data types of an entity specify its associated meaning, constraints, possible values, operations, functions, and storage mode.
A variable is nothing but a name given to a storage area that our programs can manipulate. Each variable in TRObject has a specific type, which determines the size and layout of the variable's memory; the range of values that can be stored within that memory; and the set of operations that can be applied to the variable.
A type declaration is used to declare the data type of an identifier. The syntax of a type declaration is as follows:
var
days : integer;
Integer Types
| Type | Description |
|---|---|
| Byte | Values range from 0 to 255. |
| ShortInt | Values range from -128 to 127. |
| SmallInt | Values range from -32,768 to 32,767. |
| Integer | Values range from -2,147,483,648 to 2,147,483,647. |
| LongInt | Has the same range as Integer. |
| Int64 | Values range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. |
| Cardinal | Values range from 0 to 4,294,967,295. |
| LongWord | Values range from 0 to 4,294,967,295. |
| UInt64 | Values range from 0 to 18,446,744,073,709,551,615. |
Example
TRObject Syntax
var
age: Byte;
temperature: ShortInt;
year: SmallInt;
population: Integer;
distance: Int64;
fileSize: Cardinal;
largeNumber: UInt64;
balance: LongInt;
memorySize: LongWord;
{
age = 25;
temperature = -15;
year = 1990;
population = 1500000;
distance = 10000000000;
fileSize = 4000000;
largeNumber = 1200000000000000000;
balance = -5000000;
memorySize = 3000000000;
ShowMessage(age);
ShowMessage(temperature);
ShowMessage(year);
ShowMessage(population);
ShowMessage(distance);
ShowMessage(fileSize);
ShowMessage(largeNumber);
ShowMessage(balance);
ShowMessage(memorySize);
}
Base Syntax
var age: Byte; temperature: ShortInt; year: SmallInt; population: Integer; distance: Int64; fileSize: Cardinal; largeNumber: UInt64; balance: LongInt; memorySize: LongWord; begin age := 25; temperature := -15; year := 1990; population := 1500000; distance := 10000000000; fileSize := 4000000; largeNumber := 1200000000000000000; balance := -5000000; memorySize := 3000000000; ShowMessage(age); ShowMessage(temperature); ShowMessage(year); ShowMessage(population); ShowMessage(distance); ShowMessage(fileSize); ShowMessage(largeNumber); ShowMessage(balance); ShowMessage(memorySize); end;
| Sr.No | Type & Description |
|---|---|
| 1 | Character Typically a single octet (one byte). This is an integer type. |
| 2 | Integer The most natural size of integer for the machine. |
| 3 | Real A single-precision floating point value. |
| 4 | Boolean Specifies true or false logical values. This is also an integer type. |
| 5 | Enumerated Specifies a user-defined list. |
| 6 | Subrange Represents variables, whose values lie within a range. |
| 7 | String Stores an array of characters. |