Imports System Imports uCalcSoftware Public Module Program Public Sub SumIfType(ByVal cb As uCalc.Callback) Dim typeName = cb.ArgStr(1) Dim total As Double = 0 Dim totalStr As String = "" Dim i = 0 '// Loop through all arguments starting from the second one. For i = 2 To cb.ArgCount() Dim item = cb.ArgItem(i) '// Check if the argument's data type name matches. If item.DataType.Name = "double" Then total = total + item.Value() ElseIf item.DataType.Name = "string" Then totalStr = totalStr + item.ValueStr() End If Next If typeName = "double" Then totalStr = total.ToString() End If cb.ReturnStr(totalStr) End Sub Public Sub Main() Dim uc As New uCalc() '// Define the variadic function. uc.DefineFunction("SumIfType(typeName As String, ByHandle other As AnyType ...) As String", AddressOf SumIfType) '// This call will sum only the double values (5.0 and 10.123456), ignoring the integer. Console.WriteLine(uc.EvalStr("SumIfType('double', 5.0, 'Hello ', 10.123456, 'world!')")) '// This call will concatinate only the string values. Console.WriteLine(uc.EvalStr("SumIfType('string', 5.0, 'Hello ', 10.123456, 'world!')")) End Sub End Module