Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      '// Trigger an error and check the code
      uc.EvalStr("1+")
      Console.WriteLine($"1. Error code after failure: {uc.Error.Code.ToString("D")}")
      
      '// A successful evaluation should clear the error code
      uc.EvalStr("1+1")
      Console.WriteLine($"2. Error code after success: {uc.Error.Code.ToString("D")}")
      
      '// Trigger a different type of error
      uc.Error.TrapOnDivideByZero = true
      uc.EvalStr("1/0")
      Console.WriteLine($"3. Error code after new failure: {uc.Error.Code.ToString("D")}")
      
      '// A successful definition should also clear the error code
      uc.DefineVariable("x=5")
      Console.WriteLine($"4. Error code after successful definition: {uc.Error.Code.ToString("D")}")
   End Sub
End Module