Evaluate

concerns

The Evaluate function interprets the passed string as an expression, which is then translated and executed.

 

Syntax

Evaluate(Expression)

Return value

Type

Description

Long

Error code or 0 on successful execution

Parameter

Use

Name

Type

Passing

Description

Required

Expression

String

ByVal

Expression to be compiled and executed by the interpreter

Example:

 

Evaluate("MsgBox(""Hello World"")")

A message box appears with the text "Hello World".

 

Evaluate("Amount := 10")

The variable Amount gets the value 10

 

Another way to evaluate is to use reference variables:

For this example, a class variable "Length" of the type Double was created before.

 

Dim Ref As Reference

 

Ref.Expression := "Length"

 

If Ref.ExpressionInvalid <> 0 Then

   MsgBox "Invalid expression."

   Return

End If

 

Ref := 20.45

 

#Check of the assignment

MsgBox(Length)

The length variable now contains the value 20.45