How long to pay off $30,000 loan?

Correct me if I’m wrong, but I believe that the balance of the loan is forgiven after a certain amount of time. I think this provision is to ensure that people are not forced to forgo long-term work in lower-paying fields like teaching, social work, nonprofit work, etc.