uCalc API Version: 2.1.3-preview.2 Released: 6/16/2026
Warning
uCalc API Preview Release Notice:The documentation describes the intended behavior of the API. The current preview build contains incomplete features, unoptimized performance, and is subject to breaking changes.
ValueStr(string)
Method
Product:
Class:
Sets the value of an Item by parsing and evaluating a string expression.
Syntax
Parameters
Return
void
Remarks
ValueStr is a powerful and versatile method for setting the value of an Item (typically a variable) by parsing and evaluating a string expression. Unlike type-specific setters like ValueInt32(int), this method accepts a string, processes it through the uCalc engine, and assigns the result, automatically handling type conversions.
⚙️ How It Works
When you call item.ValueStr("5 * 2") on an integer variable, uCalc performs the following steps:
- Parse & Evaluate: The string
"5 * 2"is parsed and evaluated, resulting in the numeric value10. - Type Coercion: The engine checks the target variable's DataType (in this case, an integer).
- Assignment: The result
10is safely converted to the target type and assigned to the variable.
This mechanism allows you to set variables of any type—Int, Double, String, Complex, Boolean—using a consistent, string-based input. For string literals, the expression should be enclosed in single quotes (e.g., 'hello world').
🆚 Comparative Analysis: uCalc vs. Native Languages
In a statically-typed language like C# or C++, setting a variable from a string requires explicit parsing and error handling for each data type.
Native C# Approach:
int myInt;string userInput = "123";if (!int.TryParse(userInput, out myInt)){ // Handle parsing error...}You would need separate logic for double.TryParse, bool.TryParse, and complex custom parsing for other types.
The uCalc Advantage:uCalc abstracts this complexity into a single method call. It leverages its own internal parser and type system to handle the conversion seamlessly.
// Define an integer variablevar myInt = uc.DefineVariable("myInt As Int");// Set its value from a string expression. uCalc handles parsing and conversion.myInt.ValueStr("100 + 23"); Console.WriteLine(myInt.ValueInt32()); // Output: 123This is particularly powerful for applications that accept user input or read from configuration files, as it centralizes the logic for interpreting and assigning values.
💡 When to Use ValueStr vs. Value<Type>
- Use
ValueStr("...")when your source data is a string that needs to be parsed (e.g., user input, file content). - Use a type-specific setter like
ValueInt32(123)when you already have a native variable in your host application (C#, C++, etc.) and want to assign its value directly, which is more performant as it bypasses the parsing step.
This method is the setter counterpart to the getter version of ValueStr().
Examples
Using ValueStr()
using uCalcSoftware;
var uc = new uCalc();
var MyStr = uc.DefineVariable("MyStr As String");
var MyDbl = uc.DefineVariable("MyDbl As Double");
var MyCplx = uc.DefineVariable("MyCplx As Complex");
var MyBool = uc.DefineVariable("MyBool As Boolean");
MyStr.ValueStr("Hello world!");
MyDbl.ValueStr("123.456");
MyCplx.ValueStr("3+4*#i");
MyBool.ValueStr("True");
Console.WriteLine(uc.EvalStr("$'MyStr = {MyStr}'"));
Console.WriteLine(uc.EvalStr("$'MyDbl = {MyDbl}'"));
Console.WriteLine(uc.EvalStr("$'MyCplx = {MyCplx}'"));
Console.WriteLine(uc.EvalStr("$'MyBool = {MyBool}'"));
Console.WriteLine("---");
Console.WriteLine(MyStr.ValueStr());
Console.WriteLine(MyDbl.ValueStr());
Console.WriteLine(MyCplx.ValueStr());
Console.WriteLine(MyBool.ValueStr());
MyStr = Hello world!
MyDbl = 123.456
MyCplx = 3+4i
MyBool = true
---
Hello world!
123.456
3+4i
true using uCalcSoftware; var uc = new uCalc(); var MyStr = uc.DefineVariable("MyStr As String"); var MyDbl = uc.DefineVariable("MyDbl As Double"); var MyCplx = uc.DefineVariable("MyCplx As Complex"); var MyBool = uc.DefineVariable("MyBool As Boolean"); MyStr.ValueStr("Hello world!"); MyDbl.ValueStr("123.456"); MyCplx.ValueStr("3+4*#i"); MyBool.ValueStr("True"); Console.WriteLine(uc.EvalStr("$'MyStr = {MyStr}'")); Console.WriteLine(uc.EvalStr("$'MyDbl = {MyDbl}'")); Console.WriteLine(uc.EvalStr("$'MyCplx = {MyCplx}'")); Console.WriteLine(uc.EvalStr("$'MyBool = {MyBool}'")); Console.WriteLine("---"); Console.WriteLine(MyStr.ValueStr()); Console.WriteLine(MyDbl.ValueStr()); Console.WriteLine(MyCplx.ValueStr()); Console.WriteLine(MyBool.ValueStr());
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
auto MyStr = uc.DefineVariable("MyStr As String");
auto MyDbl = uc.DefineVariable("MyDbl As Double");
auto MyCplx = uc.DefineVariable("MyCplx As Complex");
auto MyBool = uc.DefineVariable("MyBool As Boolean");
MyStr.ValueStr("Hello world!");
MyDbl.ValueStr("123.456");
MyCplx.ValueStr("3+4*#i");
MyBool.ValueStr("True");
cout << uc.EvalStr("$'MyStr = {MyStr}'") << endl;
cout << uc.EvalStr("$'MyDbl = {MyDbl}'") << endl;
cout << uc.EvalStr("$'MyCplx = {MyCplx}'") << endl;
cout << uc.EvalStr("$'MyBool = {MyBool}'") << endl;
cout << "---" << endl;
cout << MyStr.ValueStr() << endl;
cout << MyDbl.ValueStr() << endl;
cout << MyCplx.ValueStr() << endl;
cout << MyBool.ValueStr() << endl;
}
MyStr = Hello world!
MyDbl = 123.456
MyCplx = 3+4i
MyBool = true
---
Hello world!
123.456
3+4i
true #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; auto MyStr = uc.DefineVariable("MyStr As String"); auto MyDbl = uc.DefineVariable("MyDbl As Double"); auto MyCplx = uc.DefineVariable("MyCplx As Complex"); auto MyBool = uc.DefineVariable("MyBool As Boolean"); MyStr.ValueStr("Hello world!"); MyDbl.ValueStr("123.456"); MyCplx.ValueStr("3+4*#i"); MyBool.ValueStr("True"); cout << uc.EvalStr("$'MyStr = {MyStr}'") << endl; cout << uc.EvalStr("$'MyDbl = {MyDbl}'") << endl; cout << uc.EvalStr("$'MyCplx = {MyCplx}'") << endl; cout << uc.EvalStr("$'MyBool = {MyBool}'") << endl; cout << "---" << endl; cout << MyStr.ValueStr() << endl; cout << MyDbl.ValueStr() << endl; cout << MyCplx.ValueStr() << endl; cout << MyBool.ValueStr() << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim MyStr = uc.DefineVariable("MyStr As String")
Dim MyDbl = uc.DefineVariable("MyDbl As Double")
Dim MyCplx = uc.DefineVariable("MyCplx As Complex")
Dim MyBool = uc.DefineVariable("MyBool As Boolean")
MyStr.ValueStr("Hello world!")
MyDbl.ValueStr("123.456")
MyCplx.ValueStr("3+4*#i")
MyBool.ValueStr("True")
Console.WriteLine(uc.EvalStr("$'MyStr = {MyStr}'"))
Console.WriteLine(uc.EvalStr("$'MyDbl = {MyDbl}'"))
Console.WriteLine(uc.EvalStr("$'MyCplx = {MyCplx}'"))
Console.WriteLine(uc.EvalStr("$'MyBool = {MyBool}'"))
Console.WriteLine("---")
Console.WriteLine(MyStr.ValueStr())
Console.WriteLine(MyDbl.ValueStr())
Console.WriteLine(MyCplx.ValueStr())
Console.WriteLine(MyBool.ValueStr())
End Sub
End Module
MyStr = Hello world!
MyDbl = 123.456
MyCplx = 3+4i
MyBool = true
---
Hello world!
123.456
3+4i
true Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim MyStr = uc.DefineVariable("MyStr As String") Dim MyDbl = uc.DefineVariable("MyDbl As Double") Dim MyCplx = uc.DefineVariable("MyCplx As Complex") Dim MyBool = uc.DefineVariable("MyBool As Boolean") MyStr.ValueStr("Hello world!") MyDbl.ValueStr("123.456") MyCplx.ValueStr("3+4*#i") MyBool.ValueStr("True") Console.WriteLine(uc.EvalStr("$'MyStr = {MyStr}'")) Console.WriteLine(uc.EvalStr("$'MyDbl = {MyDbl}'")) Console.WriteLine(uc.EvalStr("$'MyCplx = {MyCplx}'")) Console.WriteLine(uc.EvalStr("$'MyBool = {MyBool}'")) Console.WriteLine("---") Console.WriteLine(MyStr.ValueStr()) Console.WriteLine(MyDbl.ValueStr()) Console.WriteLine(MyCplx.ValueStr()) Console.WriteLine(MyBool.ValueStr()) End Sub End Module
DefineVariable examples
using uCalcSoftware;
var uc = new uCalc();
var MyVar = uc.DefineVariable("MyVar");
var MyInt = uc.DefineVariable("MyInt As Int");
var MyStr = uc.DefineVariable("MyStr As String");
uc.DefineVariable("OtherStr = 'string type inferred'");
uc.DefineVariable("MyInt16 = Int16(100/3)"); // type inferred
uc.DefineVariable("MyBool = True"); // type inferred
uc.DefineVariable("MyComplex = 3 + 4*#i"); // type inferred
MyVar.Value(123);
MyInt.ValueInt32(456);
MyStr.ValueStr("This is a test");
Console.WriteLine("MyVar = " + uc.EvalStr("MyVar"));
Console.WriteLine("MyInt = " + uc.EvalStr("MyInt"));
Console.WriteLine("MyStr = " + uc.EvalStr("MyStr"));
Console.WriteLine("OtherStr = " + uc.EvalStr("OtherStr"));
Console.WriteLine("MyInt16 = " + uc.EvalStr("MyInt16"));
Console.WriteLine("MyBool = " + uc.EvalStr("MyBool"));
Console.WriteLine("MyComplex = " + uc.EvalStr("MyComplex"));
Console.WriteLine("---");
Console.WriteLine(MyVar.Value());
Console.WriteLine(MyInt.ValueInt32());
Console.WriteLine(MyStr.ValueStr());
Console.WriteLine("---");
Console.WriteLine(uc.ItemOf("MyVar").DataType.Name);
Console.WriteLine(uc.ItemOf("MyInt").DataType.Name);
Console.WriteLine(uc.ItemOf("MyStr").DataType.Name);
Console.WriteLine(uc.ItemOf("OtherStr").DataType.Name);
Console.WriteLine(uc.ItemOf("MyInt16").DataType.Name);
Console.WriteLine(uc.ItemOf("MyBool").DataType.Name);
Console.WriteLine("---");
var Expression = "x^2 * 10";
var VarX = uc.DefineVariable("x");
var ParsedExpr = uc.Parse(Expression);
Console.Write("Expression = ");
Console.WriteLine(Expression);
for (int x = 1; x <= 10; x++) {
VarX.Value(x); // In C++ you can skip this by passing &x to DefineVariable
Console.WriteLine("x = " + VarX.ValueStr() + " Result = " + ParsedExpr.EvaluateStr());
}
ParsedExpr.Release();
VarX.Release();
MyVar = 123
MyInt = 456
MyStr = This is a test
OtherStr = string type inferred
MyInt16 = 33
MyBool = true
MyComplex = 3+4i
---
123
456
This is a test
---
double
int
string
string
int16
bool
---
Expression = x^2 * 10
x = 1 Result = 10
x = 2 Result = 40
x = 3 Result = 90
x = 4 Result = 160
x = 5 Result = 250
x = 6 Result = 360
x = 7 Result = 490
x = 8 Result = 640
x = 9 Result = 810
x = 10 Result = 1000 using uCalcSoftware; var uc = new uCalc(); var MyVar = uc.DefineVariable("MyVar"); var MyInt = uc.DefineVariable("MyInt As Int"); var MyStr = uc.DefineVariable("MyStr As String"); uc.DefineVariable("OtherStr = 'string type inferred'"); uc.DefineVariable("MyInt16 = Int16(100/3)"); // type inferred uc.DefineVariable("MyBool = True"); // type inferred uc.DefineVariable("MyComplex = 3 + 4*#i"); // type inferred MyVar.Value(123); MyInt.ValueInt32(456); MyStr.ValueStr("This is a test"); Console.WriteLine("MyVar = " + uc.EvalStr("MyVar")); Console.WriteLine("MyInt = " + uc.EvalStr("MyInt")); Console.WriteLine("MyStr = " + uc.EvalStr("MyStr")); Console.WriteLine("OtherStr = " + uc.EvalStr("OtherStr")); Console.WriteLine("MyInt16 = " + uc.EvalStr("MyInt16")); Console.WriteLine("MyBool = " + uc.EvalStr("MyBool")); Console.WriteLine("MyComplex = " + uc.EvalStr("MyComplex")); Console.WriteLine("---"); Console.WriteLine(MyVar.Value()); Console.WriteLine(MyInt.ValueInt32()); Console.WriteLine(MyStr.ValueStr()); Console.WriteLine("---"); Console.WriteLine(uc.ItemOf("MyVar").DataType.Name); Console.WriteLine(uc.ItemOf("MyInt").DataType.Name); Console.WriteLine(uc.ItemOf("MyStr").DataType.Name); Console.WriteLine(uc.ItemOf("OtherStr").DataType.Name); Console.WriteLine(uc.ItemOf("MyInt16").DataType.Name); Console.WriteLine(uc.ItemOf("MyBool").DataType.Name); Console.WriteLine("---"); var Expression = "x^2 * 10"; var VarX = uc.DefineVariable("x"); var ParsedExpr = uc.Parse(Expression); Console.Write("Expression = "); Console.WriteLine(Expression); for (int x = 1; x <= 10; x++) { VarX.Value(x); // In C++ you can skip this by passing &x to DefineVariable Console.WriteLine("x = " + VarX.ValueStr() + " Result = " + ParsedExpr.EvaluateStr()); } ParsedExpr.Release(); VarX.Release();
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
auto MyVar = uc.DefineVariable("MyVar");
auto MyInt = uc.DefineVariable("MyInt As Int");
auto MyStr = uc.DefineVariable("MyStr As String");
uc.DefineVariable("OtherStr = 'string type inferred'");
uc.DefineVariable("MyInt16 = Int16(100/3)"); // type inferred
uc.DefineVariable("MyBool = True"); // type inferred
uc.DefineVariable("MyComplex = 3 + 4*#i"); // type inferred
MyVar.Value(123);
MyInt.ValueInt32(456);
MyStr.ValueStr("This is a test");
cout << "MyVar = " + uc.EvalStr("MyVar") << endl;
cout << "MyInt = " + uc.EvalStr("MyInt") << endl;
cout << "MyStr = " + uc.EvalStr("MyStr") << endl;
cout << "OtherStr = " + uc.EvalStr("OtherStr") << endl;
cout << "MyInt16 = " + uc.EvalStr("MyInt16") << endl;
cout << "MyBool = " + uc.EvalStr("MyBool") << endl;
cout << "MyComplex = " + uc.EvalStr("MyComplex") << endl;
cout << "---" << endl;
cout << MyVar.Value() << endl;
cout << MyInt.ValueInt32() << endl;
cout << MyStr.ValueStr() << endl;
cout << "---" << endl;
cout << uc.ItemOf("MyVar").DataType().Name() << endl;
cout << uc.ItemOf("MyInt").DataType().Name() << endl;
cout << uc.ItemOf("MyStr").DataType().Name() << endl;
cout << uc.ItemOf("OtherStr").DataType().Name() << endl;
cout << uc.ItemOf("MyInt16").DataType().Name() << endl;
cout << uc.ItemOf("MyBool").DataType().Name() << endl;
cout << "---" << endl;
auto Expression = "x^2 * 10";
auto VarX = uc.DefineVariable("x");
auto ParsedExpr = uc.Parse(Expression);
cout << "Expression = ";
cout << Expression << endl;
for (int x = 1; x <= 10; x++) {
VarX.Value(x); // In C++ you can skip this by passing &x to DefineVariable
cout << "x = " + VarX.ValueStr() + " Result = " + ParsedExpr.EvaluateStr() << endl;
}
ParsedExpr.Release();
VarX.Release();
}
MyVar = 123
MyInt = 456
MyStr = This is a test
OtherStr = string type inferred
MyInt16 = 33
MyBool = true
MyComplex = 3+4i
---
123
456
This is a test
---
double
int
string
string
int16
bool
---
Expression = x^2 * 10
x = 1 Result = 10
x = 2 Result = 40
x = 3 Result = 90
x = 4 Result = 160
x = 5 Result = 250
x = 6 Result = 360
x = 7 Result = 490
x = 8 Result = 640
x = 9 Result = 810
x = 10 Result = 1000 #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; auto MyVar = uc.DefineVariable("MyVar"); auto MyInt = uc.DefineVariable("MyInt As Int"); auto MyStr = uc.DefineVariable("MyStr As String"); uc.DefineVariable("OtherStr = 'string type inferred'"); uc.DefineVariable("MyInt16 = Int16(100/3)"); // type inferred uc.DefineVariable("MyBool = True"); // type inferred uc.DefineVariable("MyComplex = 3 + 4*#i"); // type inferred MyVar.Value(123); MyInt.ValueInt32(456); MyStr.ValueStr("This is a test"); cout << "MyVar = " + uc.EvalStr("MyVar") << endl; cout << "MyInt = " + uc.EvalStr("MyInt") << endl; cout << "MyStr = " + uc.EvalStr("MyStr") << endl; cout << "OtherStr = " + uc.EvalStr("OtherStr") << endl; cout << "MyInt16 = " + uc.EvalStr("MyInt16") << endl; cout << "MyBool = " + uc.EvalStr("MyBool") << endl; cout << "MyComplex = " + uc.EvalStr("MyComplex") << endl; cout << "---" << endl; cout << MyVar.Value() << endl; cout << MyInt.ValueInt32() << endl; cout << MyStr.ValueStr() << endl; cout << "---" << endl; cout << uc.ItemOf("MyVar").DataType().Name() << endl; cout << uc.ItemOf("MyInt").DataType().Name() << endl; cout << uc.ItemOf("MyStr").DataType().Name() << endl; cout << uc.ItemOf("OtherStr").DataType().Name() << endl; cout << uc.ItemOf("MyInt16").DataType().Name() << endl; cout << uc.ItemOf("MyBool").DataType().Name() << endl; cout << "---" << endl; auto Expression = "x^2 * 10"; auto VarX = uc.DefineVariable("x"); auto ParsedExpr = uc.Parse(Expression); cout << "Expression = "; cout << Expression << endl; for (int x = 1; x <= 10; x++) { VarX.Value(x); // In C++ you can skip this by passing &x to DefineVariable cout << "x = " + VarX.ValueStr() + " Result = " + ParsedExpr.EvaluateStr() << endl; } ParsedExpr.Release(); VarX.Release(); }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim MyVar = uc.DefineVariable("MyVar")
Dim MyInt = uc.DefineVariable("MyInt As Int")
Dim MyStr = uc.DefineVariable("MyStr As String")
uc.DefineVariable("OtherStr = 'string type inferred'")
uc.DefineVariable("MyInt16 = Int16(100/3)") '// type inferred
uc.DefineVariable("MyBool = True") '// type inferred
uc.DefineVariable("MyComplex = 3 + 4*#i") '// type inferred
MyVar.Value(123)
MyInt.ValueInt32(456)
MyStr.ValueStr("This is a test")
Console.WriteLine("MyVar = " + uc.EvalStr("MyVar"))
Console.WriteLine("MyInt = " + uc.EvalStr("MyInt"))
Console.WriteLine("MyStr = " + uc.EvalStr("MyStr"))
Console.WriteLine("OtherStr = " + uc.EvalStr("OtherStr"))
Console.WriteLine("MyInt16 = " + uc.EvalStr("MyInt16"))
Console.WriteLine("MyBool = " + uc.EvalStr("MyBool"))
Console.WriteLine("MyComplex = " + uc.EvalStr("MyComplex"))
Console.WriteLine("---")
Console.WriteLine(MyVar.Value())
Console.WriteLine(MyInt.ValueInt32())
Console.WriteLine(MyStr.ValueStr())
Console.WriteLine("---")
Console.WriteLine(uc.ItemOf("MyVar").DataType.Name)
Console.WriteLine(uc.ItemOf("MyInt").DataType.Name)
Console.WriteLine(uc.ItemOf("MyStr").DataType.Name)
Console.WriteLine(uc.ItemOf("OtherStr").DataType.Name)
Console.WriteLine(uc.ItemOf("MyInt16").DataType.Name)
Console.WriteLine(uc.ItemOf("MyBool").DataType.Name)
Console.WriteLine("---")
Dim Expression = "x^2 * 10"
Dim VarX = uc.DefineVariable("x")
Dim ParsedExpr = uc.Parse(Expression)
Console.Write("Expression = ")
Console.WriteLine(Expression)
For x As Integer = 1 To 10
VarX.Value(x) '// In C++ you can skip this by passing &x to DefineVariable
Console.WriteLine("x = " + VarX.ValueStr() + " Result = " + ParsedExpr.EvaluateStr())
Next
ParsedExpr.Release()
VarX.Release()
End Sub
End Module
MyVar = 123
MyInt = 456
MyStr = This is a test
OtherStr = string type inferred
MyInt16 = 33
MyBool = true
MyComplex = 3+4i
---
123
456
This is a test
---
double
int
string
string
int16
bool
---
Expression = x^2 * 10
x = 1 Result = 10
x = 2 Result = 40
x = 3 Result = 90
x = 4 Result = 160
x = 5 Result = 250
x = 6 Result = 360
x = 7 Result = 490
x = 8 Result = 640
x = 9 Result = 810
x = 10 Result = 1000 Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim MyVar = uc.DefineVariable("MyVar") Dim MyInt = uc.DefineVariable("MyInt As Int") Dim MyStr = uc.DefineVariable("MyStr As String") uc.DefineVariable("OtherStr = 'string type inferred'") uc.DefineVariable("MyInt16 = Int16(100/3)") '// type inferred uc.DefineVariable("MyBool = True") '// type inferred uc.DefineVariable("MyComplex = 3 + 4*#i") '// type inferred MyVar.Value(123) MyInt.ValueInt32(456) MyStr.ValueStr("This is a test") Console.WriteLine("MyVar = " + uc.EvalStr("MyVar")) Console.WriteLine("MyInt = " + uc.EvalStr("MyInt")) Console.WriteLine("MyStr = " + uc.EvalStr("MyStr")) Console.WriteLine("OtherStr = " + uc.EvalStr("OtherStr")) Console.WriteLine("MyInt16 = " + uc.EvalStr("MyInt16")) Console.WriteLine("MyBool = " + uc.EvalStr("MyBool")) Console.WriteLine("MyComplex = " + uc.EvalStr("MyComplex")) Console.WriteLine("---") Console.WriteLine(MyVar.Value()) Console.WriteLine(MyInt.ValueInt32()) Console.WriteLine(MyStr.ValueStr()) Console.WriteLine("---") Console.WriteLine(uc.ItemOf("MyVar").DataType.Name) Console.WriteLine(uc.ItemOf("MyInt").DataType.Name) Console.WriteLine(uc.ItemOf("MyStr").DataType.Name) Console.WriteLine(uc.ItemOf("OtherStr").DataType.Name) Console.WriteLine(uc.ItemOf("MyInt16").DataType.Name) Console.WriteLine(uc.ItemOf("MyBool").DataType.Name) Console.WriteLine("---") Dim Expression = "x^2 * 10" Dim VarX = uc.DefineVariable("x") Dim ParsedExpr = uc.Parse(Expression) Console.Write("Expression = ") Console.WriteLine(Expression) For x As Integer = 1 To 10 VarX.Value(x) '// In C++ you can skip this by passing &x to DefineVariable Console.WriteLine("x = " + VarX.ValueStr() + " Result = " + ParsedExpr.EvaluateStr()) Next ParsedExpr.Release() VarX.Release() End Sub End Module