CONST

Syntax

CONST name expansion

Explanation

The CONST command defines an abbreviation for a certain Logo name. Its first input is the abbreviation, while the second input is the text string which is to replace the name every time it is encountered. If the second input is a list, its elements are formed into a text string much like the TYPE command does. Every time the name is typed, it will be replaced by its text string. Remember that this replacement is a textual replacement; it takes place before the text enters Logo at all.

When finding a constant name within a constant text, Logo will attempt to replace this name as well. This could lead to a deadlock situation when you define a constant which contains its own name like CONST "HELLO "HELLO. Therefore, Logo limits these replacements to a level of 16.

The CONST command is especially useful for defining replacements for otherwise meaningless numbers. Also, often used commands may replaced by an abbreviation.

See also POC.

Example

? CONST "NAME "MICHAEL

? CONST "HELLO [OH HI, NAME]

? POC

NAME is MICHAEL

HELLO is OH HI, NAME

? PR [HELLO]

OH HI, MICHAEL

?