using uCalcSoftware;

var uc = new uCalc();

static void GetTypeOf(uCalc.Callback cb) {
   // Get the Item object for the argument
   var item = cb.ArgItem(1);

   // Get the item's DataType, then its name, and return it as a string
   cb.ReturnStr(item.DataType.Name);
}

// The ByHandle modifier passes the argument's metadata (Item) instead of its value
uc.DefineFunction("TypeOf(ByHandle arg As AnyType) As String", 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)")}");