3-way and 2-way ball valves:

3-way and 2-way ball valves are devices used to control and divert flow in a pipeline: they function to block, open or restrict flow.
3-way ball valves feature a T- or an L-shaped port:

due to this design, the valve can connect three ports together, which can communicate or not depending on the position of the valve itself.

2-way ball valves feature two ports instead; these are most frequently used in heating or cooling systems.

Both 3-way and 2-way ball valves use 90° rotation to divert flow from one line to another; this is enabled by a rotating ball with an inner cylindrical cavity.