User Tools

Site Tools


tie_associate_a_string_value_to_an_astring_.htm
Navigation:  Language Reference > 13 - Built-in Functions >====== TIE(associate a string value to an ASTRING) ====== Previous pageReturn to chapter overviewNext page

TIE(stringtoken [,index] ,value)

blk2blue.jpg

TIE Associates a string value to an ASTRING.
stringtoken A string constant or the label of a previously declared ASTRING token.
index A numeric constant or expression defining the index value of an ASTRING. The index value may be any LONG value, if omitted or zero, the RTL returns a negative which must be used in TIED and UNTIE.
value A numeric constant or variable. The value may be any LONG value greater than zero.

The TIE statement associates a value to a particular stringtoken and index. A unique index may be allocated at runtime by either omitting the index or setting it to zero. If the index is allocated at runtime, TIE will return the generated index number.

Return Data Type:     LONG

Example:

  PROGRAM

   MAP

   END

         

INCLUDE('EQUATES.CLW')

COLOR   EQUATE(1)

SIDES   EQUATE(2)

AS1     ASTRING

    CODE

    AS1 = 'SHAPE'                    !Declare ASTRING string token

    TIE('SHAPE',COLOR,COLOR:RED)     !Associate COLOR:RED to COLOR for ASTRING SHAPE

    TIE(AS1,SIDES,3)                 !Associate 3 to SIDES for ASTRING SHAPE

    IF TIED('SHAPE',SIDES) = 3 AND | !If the value associated to SIDES = 3

     TIED(AS1,COLOR) = COLOR:RED     !and the value associated with COLOR=COLOR:RED

     MESSAGE('Shape is a red triangle')

    END

See Also:

TIED

UNTIE

tie_associate_a_string_value_to_an_astring_.htm.txt · Last modified: 2021/04/15 15:57 (external edit)