The importance of setting purposes for doing things

"What is the good reason for doing this?" - this is the question that I always ask myself before doing or trying something. For me, nothing exists without a purpose. So, I think you should ask yourself this question as well. This is because I see many people work hard on something for a long time, and they forgot the initial purpose for doing that. This leads to unhappiness and regret. Therefore, I am going to use my story of how I learned to code to let you know the importance of asking this question.