It is okay to quit, sometimes.
In fact, it is okay to quit often.
You should quit if you are on a dead-end path.
You should quit if you are facing a cliff.
You should quit if the project you are working on has a dip that is not worth the reward in the end.
Quitting the projects that do not go anywhere is essential if you want to stake out the right ones.
Quitting the projects you do not have the time or the passion or the resources to be the best in the world at both.