Is the afterlife a myth religion invented to comfort people from the thought of death?

Many skeptics past and present have claimed that religion invented the afterlife to comfort weak-minded people from the thought of death. But just the opposite is true. The idea that everything you do has lasting consequences into eternity is terrifying and forces you to focus on questions of meaning and purpose and forces you to think carefully about your actions since those actions will be scrutinized after your death.

In contrast, it is comforting to believe that you will cease to exist after ~70 years, that the consequences of your actions, no matter how selfish, destructive, or immoral they are, won’t burden you past a certain point, if at all, that your ultimate purpose is to ‘live life to the fullest,’ i.e., simply to play and enjoy yourself for no deeper reason than the pursuit of sheer pleasure. *That* is the naive fantasy people cling to, not the afterlife.

A straightforward analogy for this comes from grade school. Everyone knows that the final exam is coming. But a certain kind of student will delude himself by putting the thought of the exam out of his head. Avoiding recognition of the inevitable, this student will enjoy his semester, go out with his friends, party late nights, relax. He may even laugh at other students who spend their time studying and make attempts to get such classmates to ‘lighten up’ and ‘have a little fun.’ The last thing this student wants to do is think about that exam or contemplate what failing the exam will mean for his life after the semester is complete. Denial and self-delusion is the easier psychological response, whereas those who accept the inevitable and prepare for it are the true realists.