what is a deed in leiu, and how does it affect your credit
"In lieu of" means "in place of" and what you're asking about is "a deed in lieu of foreclosure." The process allows you to turn over ownership of your property to the lender and have the mortgage cancelled, thus avoiding a foreclosure. It's much better for your credit record than a foreclosure would have been.
A lender will usually agree only when it's clear the place can't be sold for enough to cover the debt, and the borrower has no other resources. In that situation, the homeowner would be lucky to be offered that way out.