VarPutSym Function | |
Assign a value to a field or a memory variable of a given name.
Namespace:
XSharp.RT
Assembly:
XSharp.RT (in XSharp.RT.dll) Version: 2.21
Syntax [NeedsAccessToLocalsAttribute(TRUE)]
FUNCTION VarPutSym(
symVar AS SYMBOL,
uValue AS USUAL
) AS USUAL
[NeedsAccessToLocalsAttribute(true)]
public static Usual VarPutSym(
Symbol symVar,
Usual uValue
)
Request Example
View SourceParameters
- symVar
- Type: Symbol
The name of the variable . - uValue
- Type: Usual
The value to assign to the variable.
Return Value
Type:
Usual
The value assigned to (uValue).
Remarks
If a field or memory variable called cVarName does not exist, a memory variable called cVarName is created.
Therefore, VarPut(), like MemVarPut(), can be used to create undeclared memory variables.
It should be used instead of a macro.
Examples
This example uses VarPut() to store a value into a database field:
1LOCAL cFieldName
2cFieldName := "Address"
3VarPut(cFieldName, "Hollywood, Room 222")
This example uses VarPut() to create a memory variable:
1LOCAL cHasName
2cHasName := "cPrivate"
3
4VarPut(cHasName, "new")
5? cPrivate
This example shows that the newly created variable is a MEMVAR:
1VarPut("cVar", "hi")
2? _MEMVAR->cVar
See Also