I find the 
if attached ... then
   Result := ...
end

easier to read