Imports System Imports uCalcSoftware Public Module Program Public Sub AutoDefineHandler(ByVal h As Handle_uCalc) Dim uc As New uCalc(h) '// Check if the error is specifically an undefined identifier If uc.Error.Code = ErrorCode.Undefined_Identifier Then '// If so, define the missing variable and instruct uCalc to resume Console.WriteLine($"Auto-defining variable: '{uc.Error.Symbol}'") uc.DefineVariable(uc.Error.Symbol) uc.Error.Response = ErrorHandlerResponse.Resume End If End Sub Public Sub Main() Dim uc As New uCalc() uc.Error.AddHandler(AddressOf AutoDefineHandler) '// 'x' doesn't exist, but the handler will intercept the error and create it. Dim Result = uc.EvalStr("x = 10; x * 5") Console.WriteLine($"Result: {Result}") End Sub End Module