Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim expr As 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: {CInt(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: {CInt(expr.uCalc.Error.Code)}")
   End Sub
End Module