Gamma: Version 4.0
Prev |  | Next

# 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 1. Integers

Notation | Description | Example
--- | --- | ---
| Decimal notation | 539
0b | Binary notation | 0b1011
0o | Octal notation | 0o462
0x | Hexadecimal notation | 0x35fc
' ' | 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 2. Real numbers

Notation | Description | Example
--- | --- | ---
[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 3. Strings

Notation | Description | Example
--- | --- | ---
" " | Contents are a string. | "Good morning."

## Symbols

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

Table 4. Symbols

Notation | Description | Example
--- | --- | ---
[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 5. Other Data Types

Data type | Reference entry
--- | ---
Array | `array`
Buffer | `buffer`
List | `list`
Instance | `new`
Function | `function`
Method | `method`
Class | `class`
File | `open`
Task | `locate_task`

Prev | Home | Next
`undefined_p`, `undefined_symbol_p` | Up | Predefined Symbols

Copyright 1995-2002 by Cogent Real-Time Systems, Inc.