function TForm1.test(var s: string): string;
begin
if (s='In') then
result:='Result of '+s+' = Out'
else if (s='Out') then
result:='Result of '+s+' = In';
end;
procedure TForm1.btnTestClick(Sender: TObject);
var
s,s1:string;
begin
s:='In';
s1:=test(s);
showMessage(s1);
end;