Just to provide an anecdote: I sunk probably around 20k into a startup over the course of a couple years. The startup went absolutely nowhere however I learned a ton. Not only technically but about myself and time management.
That 20k turned into a new job, which I would not have been able to get otherwise, that greatly exceeded the money I spent failing.
Sometimes success is not exactly what you could have imagined.