Quitting – am I thinking about it the right way?

From the Jan workbook:
When is quitting a good idea? Why?

When there is nothing left to try. Because there is no use flogging a dead horse. When all the options have been exhausted and the desired result still hasn’t been achieved this is the time to acknowledge that this result is not possible. Otherwise I will just expend valuable energy into something that’s not working. More than likely this will result in stress/burnout.

I get the feeling that there is a way to think about quitting so that it’s never a good idea but the above answer if about as close as I can get to that. Can you share your thoughts and how you get there?