What is the formula for the slope of a line segment whose endpoints are (x1,y1) and (x2,y2)?

The formula for the slope of a line segment is given by:

slope = (y2 - y1) / (x2 - x1)