The rotate_extrude() command operates on 2d shapes by extruding them around the Z-axis. To create a rotated extrusion in another axis apply a transformation after the rotate_extrude operation.
To create an extrusion first create a 2d shape. We will use a square.
square([2,10], center = true)
To get the pipe shape we will move the square 5 units on the X axis.
A simple way to image the revolve is, when you have the 2d object in view, image the X axis will end up as the Z axis and the rotation will occur counterclockwise when looking from above.
First OpenSCAD will orient the 2d Shape to the Z-Axis
Then OpenSCAD will revolve the shape around the Z-Axis.
To create a revolve that only travels a portion of the revolve arc use the angle keyword