I don't know if it's the best way, as you did not specify the criteria for being the best, but you can use the VALUES statement, like so:
create function()
returns table(a integer,b integer)
language sql
begin
return values (10, 20);
end@
or, if you really need variables:
create function()
returns table(a integer,b integer)
language sql
begin
declare c integer;
declare d integer;
set c=10;
set d=20;
return values (c, d);
end@