Click or drag to resize

MAssign Function

X#
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.19
Syntax
 FUNCTION MAssign(
	cExp AS STRING,
	uValue AS USUAL
) AS USUAL
Request Example 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#
1MEMVAR iValue
2LOCAL cVar AS STRING
3cVar := "iValue"
4MAssign(cVar, 5)        // Same a &cVar := 5
5? iValue                    // Result: 5
See Also