using uCalcSoftware;

var uc = new uCalc();
var expr = new uCalc.Expression();

// Implicitly parse an invalid expression. This sets an error state.
expr = "5 * (10 +";

// Implicit EvaluateStr should not throw but return the error message.
Console.WriteLine($"Error Message: {expr}");

// Verify the error code is set.
Console.WriteLine($"Error Code: {(int)expr.uCalc.Error.Code}");

// Now, assign a valid expression.
expr = "10 + 20";

// The new assignment should clear the error state.
Console.WriteLine($"Valid Result: {expr}");
Console.WriteLine($"Error Code after success: {(int)expr.uCalc.Error.Code}");