Click or drag to resize

Evaluate Function (String)

Evaluate an expression contained in a string.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.4a
Syntax
 FUNCTION Evaluate(
	cString AS STRING
) AS USUAL
View Source

Parameters

cString
Type: String
The string containing the expression to evaluate.

Return Value

Type: Usual
The value of the expression.
Remarks
Evaluate() invokes the macro compiler each time it evaluates an expression.
Alternatively, you could use MCompile() to compile an expression only once, then use MExec() to execute the compiled form as often as you want.
Examples
This example shows typical uses of Evaluate():
X#
1LOCAL cVar AS STRING
2cVar := "World"
3World := "Hello"    // World is a PRIVATE variable
4? Evaluate(cVar)    // Hello
5? Evaluate("2+3")    // 5
6Two := 2    // Two is a PRIVATE variable
7Evaluate("Two+3")    // 5
See Also