Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim VariableX = uc.DefineVariable("x = 0")
      Dim Total = uc.DefineVariable("Total")
      Dim Expression As String = "x++; Total = Total + x^2 + 5"
      
      Dim ParsedExpr = uc.Parse(Expression)
      
      For x  As Double = 1 To 10
         '// Execute() runs the parsed expression without the overhead of returning a value.
         '// This provides near-native performance for loops across C#, VB, and C++.
         ParsedExpr.Execute()
         
         '// Evaluate string interpolation to output the final calculated total
         Console.WriteLine(uc.EvalStr("$'{x}   Sub total = {Total}'"))
      Next
      
      Console.WriteLine(uc.EvalStr("$'Total = {Total}'"))
      
      ParsedExpr.Release()
      VariableX.Release()
   End Sub
End Module