SET        Assign or concatenate string variable(s)

Top  Previous  Next

Syntax:

SET

[ variable ]  =  [ value ] [ & value2 ] [ &  value3 ] [ &  value4 ]

Alt Syntax:

SET

[ variable ] [ &= value ]

Arguments:

[ variable ]

Variable to assign; if the variable does not previously exist it is created.

 

[ value ]

Variable or string defining the value to assign to [ variable ] or the first concatenation string when followed with the concatenation operator.

 

&

The catenation operator; + is also recognized.

 

[ value2 ]

Variable or string defining the optional second string to concatenate to [ value ] with result stored in [ variable ].

 

[ value3 ]

Variable or string defining the optional third string to concatenate to [ value ] & [ value2 ] with result stored in [ variable ].

 

[ value4 ]

Variable or string defining the optional fourth string to concatenate to [ value ] & [ value2 ] & [ value3 ] with result stored in [ variable ].

 

[ &= value ]

Variable or string value to concatenate to [ variable ] with result stored in [ variable ] when the alternate concatenation syntax is used.

Options:

none

 

 

 

This script command assigns a string value to a variable or concatenates up to four strings and assigned the resulting string to a variable.

 

Consider the following examples:

 

       ;; assign a variable to a string

       SET new_string = "this is a new string"

 

       ;; assign a variable to a previously assigned variable

       SET another_string = new_string

 

       ;; concatenate two strings

       SET hello_world = "hello " & "world"

       

       ;; concatenate four variables

       SET var1 = "FileLink "

       SET var2 = "is "

       SET var3 = "the "

       SET var4 = "greatest."

       SET truth = var1 & var2 & var3 & var4

 

       ;; concatenate two strings (alternate syntax)

       SET hello_world = "hello "

       SET hello_world &= "world"

 

Related Command(s):        INC, DEC, SETLEFT, SETRIGHT, SETMID

See also: Script File Variable Arguments