The newer water heaters have the valve in the front, but on my 3rd floor condo the drain line is in the back of the old water heater, almost exactly 180 degrees. I can twist a new one around maybe 60 degrees,

How do I plumb the line?
Do I use Pex pipe, I guess it is 3/4"

Would that meet code??