Type Characters
Identifier type characters
ViviFire supplies a set of identifier type characters that you can use to specify the data type of a variable or constant. The table that follows shows the available identifier type characters with code examples.
Type character | Data type | Example |
---|---|---|
% |
Int32 |
|
! |
Real64 |
|
@ |
Fixed64 |
|
$ |
String |
|
There are no identifier type characters for the data types Boolean
, Char
, Fixed128
, Int8
, Int16
, Int64
, Int128
, Real32
, Real128
, SafeString
, SBits
, UBits
, or UInt8
thru UInt128
.
Also, compound data types, for example, arrays and structures do not have an identifier type character.
Default literal types
The qualities of a literal usually give it its data type. The table that follows gives the defaults.
Qualities of a literal | Default data type | Examples |
---|---|---|
Number, no fraction part | Int32 |
|
Number with a fraction part | Real64 |
|
Between two backtick symbols | Char |
|
Starts with a percent symbol and a minimum of two letters | Int32 |
|
Between two quotation symbols | String |
|
Starts with a dollar symbol | String |
|
Three groups of numbers connected with slashes, hyphens, or colons | DateTime |
|
Starts with an at-symbol or currency symbol, number | Fixed64 |
|
Three or four groups of numbers connected with dots | version number |
|
Hexadecimal, octal, and binary literals
Number base | Prefix | Applicable digits | Examples |
---|---|---|---|
Hexadecimal (base 16) | %X or %x |
0–9 A–F |
|
Octal (base 8) | %O or %o |
0–7 |
|
Binary (base 2) | %B or %b |
0 1 |
|
Note:
Hexadecimal literals must have a number (0–9) or underscore (_
) immediately after X.
If you put a letter after X, it will be seen as a named constant.