String expressions

A string expression is any expression that evaluates to, or can be converted to a string of characters.

A string expression can be a string constant, a numeric constant, a variable with a string or numeric value, a substring, a concatenation of string expressions, an intrinsic function, or a format mask.

Concatenation of strings is specified by a : or by the cat operator. The cat operator must be preceded and followed by spaces.

The result of a string expression is an ASCII character string.

String expressions can include arithmetic expressions. The results of any numeric function or arithmetic expression is converted to an equivalent ASCII string.


The string expression consists of the literal string, "the total amount is ", followed by the contents of the variable amount.

print "the total amount is " : amount

The results of the arithmetic expression unit.price * quantity is converted to ASCII and concatenated to the literal string.

line = "the total amount is " : unit.price * quantity

In this example, name is a string expression.

name = "Rocket"