EvaluateBool, also ValueStr which converts numeric value to string
ID: 93
See: EvaluateBool, ValueStr(bool)
using uCalcSoftware;
var uc = new uCalc();
var VariableX = uc.DefineVariable("x");
var ParsedExpr = uc.Parse("x > 3"); // The > operation returns a Boolean instead of the default floating point
for (double x = 1; x <= 5; x++) {
VariableX.Value(x);
Console.WriteLine($"x = {VariableX.ValueStr()} x > 3 is {ParsedExpr.EvaluateBool()}");
}
ParsedExpr.Release();
VariableX.Release();
x = 1 x > 3 is False
x = 2 x > 3 is False
x = 3 x > 3 is False
x = 4 x > 3 is True
x = 5 x > 3 is True using uCalcSoftware; var uc = new uCalc(); var VariableX = uc.DefineVariable("x"); var ParsedExpr = uc.Parse("x > 3"); // The > operation returns a Boolean instead of the default floating point for (double x = 1; x <= 5; x++) { VariableX.Value(x); Console.WriteLine($"x = {VariableX.ValueStr()} x > 3 is {ParsedExpr.EvaluateBool()}"); } ParsedExpr.Release(); VariableX.Release();
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
#define tf(IsTrue) ((IsTrue) ? "True" : "False")
int main() {
uCalc uc;
auto VariableX = uc.DefineVariable("x");
auto ParsedExpr = uc.Parse("x > 3"); // The > operation returns a Boolean instead of the default floating point
for (double x = 1; x <= 5; x++) {
VariableX.Value(x);
cout << "x = " << VariableX.ValueStr() << " x > 3 is " << tf(ParsedExpr.EvaluateBool()) << endl;
}
ParsedExpr.Release();
VariableX.Release();
}
x = 1 x > 3 is False
x = 2 x > 3 is False
x = 3 x > 3 is False
x = 4 x > 3 is True
x = 5 x > 3 is True #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; #define tf(IsTrue) ((IsTrue) ? "True" : "False") int main() { uCalc uc; auto VariableX = uc.DefineVariable("x"); auto ParsedExpr = uc.Parse("x > 3"); // The > operation returns a Boolean instead of the default floating point for (double x = 1; x <= 5; x++) { VariableX.Value(x); cout << "x = " << VariableX.ValueStr() << " x > 3 is " << tf(ParsedExpr.EvaluateBool()) << endl; } ParsedExpr.Release(); VariableX.Release(); }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim VariableX = uc.DefineVariable("x")
Dim ParsedExpr = uc.Parse("x > 3") '// The > operation returns a Boolean instead of the default floating point
For x As Double = 1 To 5
VariableX.Value(x)
Console.WriteLine($"x = {VariableX.ValueStr()} x > 3 is {ParsedExpr.EvaluateBool()}")
Next
ParsedExpr.Release()
VariableX.Release()
End Sub
End Module
x = 1 x > 3 is False
x = 2 x > 3 is False
x = 3 x > 3 is False
x = 4 x > 3 is True
x = 5 x > 3 is True Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim VariableX = uc.DefineVariable("x") Dim ParsedExpr = uc.Parse("x > 3") '// The > operation returns a Boolean instead of the default floating point For x As Double = 1 To 5 VariableX.Value(x) Console.WriteLine($"x = {VariableX.ValueStr()} x > 3 is {ParsedExpr.EvaluateBool()}") Next ParsedExpr.Release() VariableX.Release() End Sub End Module