#### 37.6.1 Understanding macro expressions

Result is a string value

An expression always generates a string value, which for some purposes can be treated as a decimal integer number (or a hexadecimal number, depending on the operands); that is, you can do arithmetic on the result.

Decimal vs. hexadecimal

The numeric result of an expression is decimal by default, unless the left operand is in hexadecimal format; then the result is in hexadecimal. You can coerce output to the other base by adding zero as the first term, expressed in the desired base, to the left operand. For example, you can coerce output to decimal with (0 + 0x30), which yields 48; or to hexadecimal with (0x0 + 31), to get 0x1F.

DITA2Go does not support octal numbers or floating-point numbers.

Anonymous expressions

Where you want to use the result of an expression, but you do not need to store the result for later use, you can use “anonymous” expressions; for example:

    <$($$_count + 2)>

Previous Topic: 37.6 Using expressions in macros

Next Topic: 37.6.2 Understanding operands and operators

Parent Topic: 37.6 Using expressions in macros

Sibling Topics:

37.6.2 Understanding operands and operators

37.6.3 Displaying expression results in output

37.6.4 Using control structures in expressions

37.6.5 Specifying substrings in expressions

37.6.6 Using list variables in expressions

37.6.7 Using indirection in expressions

37.6.8 Removing spaces from strings: an example