Click or drag to resize

MAssign Function

Perform an assignment to a variable whose name is stored in a specified string.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.10
Syntax
 FUNCTION MAssign(
	cExp AS STRING,
	uValue AS USUAL
) AS USUAL
View Source

Parameters

cExp
Type: String
The string containing the variable name you want to assign <uValue> to.
uValue
Type: Usual
The value to assign.

Return Value

Type: Usual
The assigned value.
Remarks
MAssign() is the functional equivalent of using the macro operator (&) to perform an assignment.
Remarks
Tip Tip
Dynamic memory variables (PUBLIC, PRIVATE, PARAMETERS) are supported in the X# language and runtime for compatibility only.
In most cases the type can and should be replaced with lexically scoped variables, such as LOCALs and GLOBALs.
Examples
The following example uses the MAssign() function to perform assignments:
X#
MEMVAR iValue
LOCAL cVar AS STRING
cVar := "iValue"
MAssign(cVar, 5)                // Same a &cVar := 5
? iValue                                        // Result: 5
See Also