Imports System
Imports uCalcSoftware
Public Module Program
   
   Public Sub GetTypeOf(ByVal cb As uCalc.Callback)
      '// Get the Item object for the argument
      Dim item = cb.ArgItem(1)
      
      '// Get the item's DataType, then its name, and return it as a string
      cb.ReturnStr(item.DataType.Name)
   End Sub
   Public Sub Main()
      Dim uc As New uCalc()
      '// The ByHandle modifier passes the argument's metadata (Item) instead of its value
      uc.DefineFunction("TypeOf(ByHandle arg As AnyType) As String", AddressOf GetTypeOf)
      
      uc.DefineVariable("myInt As Int = 10")
      uc.DefineVariable("myStr As String = 'hello'")
      uc.DefineVariable("myDbl = 3.14") '// Type is inferred as double
      
      Console.WriteLine($"Type of myInt: {uc.EvalStr("TypeOf(myInt)")}")
      Console.WriteLine($"Type of myStr: {uc.EvalStr("TypeOf(myStr)")}")
      Console.WriteLine($"Type of myDbl: {uc.EvalStr("TypeOf(myDbl)")}")
   End Sub
End Module