It has been said:
” ‘Failure’ is just another part of the learning process on the road to eventual success”. i.e. “You learn from your mistakes”.
However, in a different quote, it is also said:
“Not every defeat imparts wisdom. Sometimes all you learn from defeat, is that you’ve been defeated”.
I suppose one has to try not to just fail or be defeated aimlessly, but succeed and win when they can, otherwise learn if they can.