uses System.Variants;
function GetName: Variant;
begin
Result := Null;
end;
var
Name: string;
N: Variant;
Value: Integer;
begin
//no ?? operator in Delphi;
//for strings there is VarToStrDef
Name := VarToStrDef(GetName, 'unknown');
//name is 'unknown'
//for other types: check and assign
N := GetName;
if VarIsNull(N) then
Value := -1
else
Value := N;
//value is -1
WriteLn('name is ', Name);
WriteLn('value is ', Value);
end.