Literals

— defined for integers, reals, strings, and symbols.

Integers

An integer is any group of digits defining a number between -2e+31 and 2e+31 - 1. It cannot contain a decimal point or an exponent. Integers have several different literal notations, but regardless of notation, all integers are 32 bit signed numbers. They are flagged internally with their respective notations and Gamma attempts to maintain and return the notation when the integer is printed.

Table 4. Integers

NotationDescriptionExample
 Decimal notation539
0bBinary notation0b1011
0oOctal notation0o462
0xHexadecimal notation0x35fc
' 'Contents are a character.'M'

Real numbers

A real number is any group of digits defining a number less than -2e+31, greater than 2e+31 - 1, or containing a non-zero mantissa. It can contain a decimal point, and it may end with the letter e followed by a signed exponent.

Table 5. Real numbers

NotationDescriptionExample
[0-9].[0-9]e[+|-][0-9]Double-precision 64 bit floating-point number.2.56e-7

Strings

A string may have any number of characters. The special forms \n, \t, \f and \r denote newline, tab, form feed, and carriage return respectively. The double quote (") and backslash (\) characters may be embedded in a string by preceding them with a backslash.

Table 6. Strings

NotationDescriptionExample
" "Contents are a string."Good morning."

Symbols

Generally, symbol names are made up of alpha-numeric characters and underscores.

Table 7. Symbols

NotationDescriptionExample
[a-z,A-Z,0-9]One or more characters chosen from : a-z, A-Z, 0-9 are valid for symbol names.Epax15
_A _ (underscore) is allowed in any part of a symbol name. This symbol is generally used to separate words in a symbol name. The use of this character at the beginning and end of a symbol is reserved for system use.my_var_name
\Any non-alphanumeric character other than _ must be preceded by a backslash to be used in a symbol name.Ft\+\$sq

Other Data Types

The literal representation for all other Gamma data types is discussed in the reference entry associated with creating or accessing that data type, as given in the table below.

Table 8. Other Data Types

Data typeReference entry
Arrayarray
Bufferbuffer
Listlist
Instancenew
Functionfunction
Methodmethod
Classclass
Fileopen
Tasklocate_task