Difference between revisions of "ReNamer:Pascal Script:Types"
Jump to navigation
Jump to search
(→Enumerations: examples) |
(custom types) |
||
Line 4: | Line 4: | ||
== Integer types == | == Integer types == | ||
+ | |||
{| class="wikitable" | {| class="wikitable" | ||
! Type | ! Type | ||
Line 35: | Line 36: | ||
== Floating point types == | == Floating point types == | ||
+ | |||
{| class="wikitable" | {| class="wikitable" | ||
! Type | ! Type | ||
Line 54: | Line 56: | ||
== String types == | == String types == | ||
+ | |||
{| class="wikitable" | {| class="wikitable" | ||
! Type | ! Type | ||
Line 91: | Line 94: | ||
== Enumerations and Sets == | == Enumerations and Sets == | ||
+ | |||
+ | For example, the Boolean data type is itself an enumeration, with two possible values: True and False. If you try to assign a different value to a Boolean variable, the code will not compile. | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 127: | Line 132: | ||
|} | |} | ||
− | + | == Custom types == | |
+ | |||
+ | Several types are custom defined to simplify the usage of some functions. | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! Type | ||
+ | ! Description | ||
+ | |- | ||
+ | | '''TDateTime''': Double | ||
+ | | Holds date and time. Used by several functions. | ||
+ | |- | ||
+ | | '''TStringsArray''': Array of WideString | ||
+ | | Holds a sequence of Ansi characters of any length | ||
+ | |} |
Revision as of 20:16, 22 July 2009
This page lists and explains all supported types in Pascal Script used within ReNamer.
Integer types
Type | Size | Range |
---|---|---|
Byte | 1 byte | 0 .. 255 |
ShortInt | 1 byte | -128 .. 127 |
Word | 2 bytes | 0 .. 65535 |
SmallInt | 2 bytes | -32768 .. 32767 |
Cardinal | 4 bytes | 0 .. 4294967295 |
Integer | 4 bytes | -2147483648 .. 2147483647 |
Floating point types
Type | Size | Range |
---|---|---|
Single | 4 bytes | 1.5 x 10-45 .. 3.4 x 1038 |
Double | 8 bytes | 5.0 x 10-324 .. 1.7 x 10308 |
Extended | 10 bytes | 3.6 x 10-4951 .. 1.1 x 104932 |
String types
Type | Description |
---|---|
Char | Stores a single Ansi character |
String | Holds a sequence of Ansi characters of any length |
WideChar | Stores a single Unicode character |
WideString | Holds a sequence of Unicode characters of any length |
Other types
Type | Description |
---|---|
Boolean | Provides an enumeration of the logical True and False values |
Array | Single and multi dimensional indexable sequences of data |
Record | Provides means of collecting together a set of different data types into one named structure |
Variant | Provides a flexible general purpose data type |
Enumerations and Sets
For example, the Boolean data type is itself an enumeration, with two possible values: True and False. If you try to assign a different value to a Boolean variable, the code will not compile.
Example | Description |
---|---|
type TDay = (Mon, Tue, Wed, Thu, Fri, Sat, Sun); var Day: TDay; begin Day := Mon; if Day <> Tue then Day := Wed; end. |
An enumeration is simply a fixed range of named values. |
type TDay = (Mon, Tue, Wed, Thu, Fri, Sat, Sun); TDays = set of TDay; var Days: TDays; begin Days := [Mon, Tue, Wed]; if Sun in Days then Days := Days - [Sun]; end. |
Whereas enumerations allow a variable to have one, and only one, value from a fixed number of values, sets allow you to have any combination of the given values |
Custom types
Several types are custom defined to simplify the usage of some functions.
Type | Description |
---|---|
TDateTime: Double | Holds date and time. Used by several functions. |
TStringsArray: Array of WideString | Holds a sequence of Ansi characters of any length |