TAL Reference Manual

Language Elements
TAL Reference Manual526371-001
2-5
Constants
Constants
A constant is a value you can store in a variable, declare as a LITERAL, or use as part
of an expression. Constants can be numbers or character strings. The kind and size of
constants a variable can accommodate depends on the data type of the variable, as
described in Data Representation on page 3-1. The following examples show
constants:
654 - !Numeric constant
"abc" - !Character string constant
Constant Expressions
A constant expression is an arithmetic expression that contains only constants,
LITERALs, and DEFINEs as operands. You can use a constant expression anywhere a
single constant is allowed. The following examples show constant expressions:
255
8 * 5 + 45 / 2
For more information, see LITERALs and DEFINEs on page 5-1.
Number Bases
You can specify numeric constants in binary, octal, decimal, or hexadecimal base
depending on the data type of the item, as described in Data Representation on
page 3-1. The default number base in TAL is decimal. The following examples show
constants in each number base:
Table 2-4. Identifier Classes
Class Meaning
Block Global Data Block
Code Read-only (P-relative) array
Variable Simple variable, array, simple pointer, structure pointer,
structure, or structure data item
DEFINE Named text
Function Procedure or subprocedure that returns a value
Label Statement Label
LITERAL Named constant
PROC Procedure or subprocedure that does not return a value
Register Index register - R5, R6, or R7
Template Template Structure