Imports System Imports uCalcSoftware Public Module Program Public Sub OutputAnswerCB(ByVal cb As uCalc.Callback) cb.ReturnStr("Answer: " + cb.ArgStr(1)) End Sub Public Sub OutputSymbolCB(ByVal cb As uCalc.Callback) cb.ReturnStr("==> " + cb.ArgStr(1)) End Sub Public Sub OutputBoolCB(ByVal cb As uCalc.Callback) If cb.ArgStr(1) = "false" Then cb.ReturnStr("No") ElseIf cb.ArgStr(1) = "true" Then cb.ReturnStr("Yes") End If End Sub Public Sub Main() Dim uc As New uCalc() '// This format inserts "Answer: " in front of every result Dim OutputAnswer = uc.Format(AddressOf OutputAnswerCB) Console.WriteLine(uc.EvalStr("10+20")) Console.WriteLine(uc.EvalStr("'Hello '+'world'")) Console.WriteLine(uc.EvalStr("5 > 10")) Console.WriteLine("---") '// This one inserts ==> in front of the result '// The previously defined "Answer: " output is still prepended as well Dim OutputSymbol = uc.Format(AddressOf OutputSymbolCB) Console.WriteLine(uc.EvalStr("10+20")) Console.WriteLine(uc.EvalStr("'Hello '+'world'")) Console.WriteLine(uc.EvalStr("5 > 10")) Console.WriteLine("---") '// Causes Boolean values to return Yes or No (instead of true or false) Dim OutputBool = uc.Format(AddressOf OutputBoolCB, "Bool") Console.WriteLine(uc.EvalStr("10+20")) Console.WriteLine(uc.EvalStr("'Hello '+'world'")) Console.WriteLine(uc.EvalStr("5 > 10")) Console.WriteLine(uc.EvalStr("5 < 10")) Console.WriteLine("---") '// The previously defined "==>" output is removed OutputSymbol.Release() Console.WriteLine(uc.EvalStr("10+20")) Console.WriteLine(uc.EvalStr("'Hello '+'world'")) Console.WriteLine(uc.EvalStr("5 > 10")) Console.WriteLine(uc.EvalStr("5 < 10")) End Sub End Module