This is an oversimplification. The average household has several kinds of debt, and generally debt should be paid down in descending order of interest rate.
More significantly, investment income opportunities need to have their interest rate (or equivalent) assessed. For example, in the past 12 months, the DIA has risen 18%. Thus, if 12 months ago I had money to spare, it would have been better to put the money into DIA rather than make an extra principal payment on the mortgage, unless my mortgage is 18% or more.
With the exception of bonds and CDs, it's not possible to know the investment growth in advance, so that creates some risk of course.
More significantly, investment income opportunities need to have their interest rate (or equivalent) assessed. For example, in the past 12 months, the DIA has risen 18%. Thus, if 12 months ago I had money to spare, it would have been better to put the money into DIA rather than make an extra principal payment on the mortgage, unless my mortgage is 18% or more.
With the exception of bonds and CDs, it's not possible to know the investment growth in advance, so that creates some risk of course.