Delphi has an option to exit with a value (Example: Exit(0);), but how do I exit with a value if the return value is a record?
TIntResult = record
Value: Integer;
Error: String;
end;
function GetCount: TIntResult;
begin
if not IsLoggedIn then
Exit(Value: 0; Error: 'Not logged in'); // I want this
if not IsAdmin then
Exit(TIntResult(Value: 0; Error: 'Not Admin')); // or this
...
end;