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.

Identifier type characters
Type characterData typeExample
% Int32
Dim a%
! Real64
Dim a!
@ Fixed64
Dim a@
$ String
Dim a$

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
32768 32_768
Number with a fraction part Real64
3.14159 4.1e-8
Between two backtick symbols Char
`A` `@`
Starts with a percent symbol and a minimum of two letters Int32
%CR %RETURN
Between two quotation symbols String
"Hello, world!"
Starts with a dollar symbol String
$CR $13 $LINE
Three groups of numbers connected with slashes, hyphens, or colons DateTime
2013/12/11
2013-12-11 10:09:08
Starts with an at-symbol or currency symbol, number Fixed64
@12.34 @$12.34 ¤12.34
@£1_234_567.89
Three or four groups of numbers connected with dots version number
1.2.3.4
1.22.333

Hexadecimal, octal, and binary literals

Number base Prefix Applicable digits Examples
Hexadecimal (base 16) %X or %x 0–9 A–F
%X0FFF %x0ff_00_2a
Octal (base 8) %O or %o 0–7
%O777 %o377_777
Binary (base 2) %B or %b 0 1
%B101010 %b11111111_11111111

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.

See also