Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      '// Set up two different uCalc contexts with the same variable name 'x'.
      uCalc.DefaultInstance.DefineVariable("x = 1.2")
      uc.DefineVariable("x = 10")
      
      Console.WriteLine("--- Testing Expression Contexts ---")
      
      '// 1. Expression created in the *default* context uses x = 1.2
      Using exprDefault As New uCalc.Expression("x + 5")
         Console.WriteLine($"Default context (x=1.2): {exprDefault.Evaluate()}")
         
         '// 2. Expression created in a *specific* context ('uc') uses x = 10
         Using exprSpecific As New uCalc.Expression(uc, "x + 5")
            Console.WriteLine($"Specific context (x=10):  {exprSpecific.Evaluate()}")
            
            '// 3. Create empty, then parse later (uses default context for the Parse call)
            Using exprEmpty As New uCalc.Expression()
               exprEmpty.Parse("x * 10")
               Console.WriteLine($"Empty then parsed (x=1.2):{exprEmpty.Evaluate()}")
            End Using
         End Using
      End Using
   End Sub
End Module