<< Home | About Forth | About TurboForth | Download | Language Reference | Resources | Tutorials | YouTube >>


2CONSTANT Search:

In Programming and Stack Management Words in 32-bit library

Word Name: 2CONSTANT
Type: Standard word
Data Stack Signature: – value
Return Stack Signature: --
Availability: V1.2
Description:

Declares and stores a double-precision constant value (a value that does not change).

Example:

1234567. 2CONSTANT AREA
AREA D. (displays 1234567)

The above example places the double-precision value 1,234,567 on the stack then calls 2CONSTANT. 2CONSTANT creates a constant in the dictionary with the name AREA and stores the value 1,234,567 into it.

The constant is subsequently referenced by simply referring to its name, leaving its value on the stack rather than its address.

Comment:

None.

See Also: CONSTANT  VARIABLE  2VARIABLE 

<< Home | About Forth | About TurboForth | Download | Language Reference | Resources | Tutorials | YouTube >>