For many entrepreneurs, this scene is all too familiar: “I lay on my floor looking up at the ceiling, wondering how it had come to this,” writes Andrew Yang in his new book Smart People Should Build Things. “I’d just been responsible for investor losses of hundreds of thousands of dollars and would be naturally lumped in with the second-rate dot-com entrepreneurs of the bubble who were now considered lousy businesspeople.”

Then he drops the F-word: “It’s hard to feel good after such a conspicuous failure.”

Experiencing failure is one thing, but trying to get over it is another. Yang was just 26 years old when his celebrity-driven philanthropic venture, Stargiving.com, went bust.  Now 39—and working as the chief executive officer of Venture for America, a program that he founded to expose young grads to startups—Yang says bouncing back takes time and is a “gradual” process.

“During the next couple of years there were ups and downs in terms of my own self-esteem, and there were periods where you genuinely don’t feel as confident and you wonder why people would trust you with resources,” Yang tells Entrepreneur. “I’m not going to pretend it’s a straight line—in my experience there’s a lot of troughs.”

Plenty of entrepreneurs, both old and young, will face failure at some point. A study by Ernst & Young that G20 countries, including the United States, need to start tolerating failed businesses if they’re to tackle youth unemployment and help young entrepreneurs.

Some argue we need to start changing society’s view on failed ventures by tackling how we, as individuals, assess and experience failure. Hope, of course, can go a long way during these tough times. In fact, some research has shown that people with higher hope tend to have better life outcomes, including physical and psychological wellbeing as well as increased engagement in their work. Unlike optimism, a state where we believe everything will work out without much intervention, “hope will propel someone to become active,” says Denise Larsen, a professor of counselling psychology and the director of the Hope Studies research center at the University of Alberta in Canada.

“Hope is about possibility—not probability,” she adds. “As long as you see some possible good outcome in a situation you’ll stay engaged.”

The good news: Making that moping-to-hoping transition is a process that can be practiced. “It’s kind of like brushing our teeth,” says Larsen. “The more we practice it, the better we get at it.” Here’s how:

-Identify meaningful aspects of your life, whether they’re other startup ideas or people that get you excited.

-Work toward specific goals, and take small steps—while celebrating any small successes along the way. If one of these steps leads you astray, though, don’t give up and try another approach. “Accepting smaller failures is good inoculation,” says Yang. “Tolerating failure is something that can be practiced.”

-Pay attention to those moments—small or big—when you miss or dismiss signs of hope, such as looking forward to a dinner with friends or the latest episode of your favorite show. Difficulties and hope can coexist, says Larsen, who adds, “It’s possible to become more hopeful by paying attention to where hope is.”

-Get inspired from other entrepreneurs by reading about their past “failures”. Don’t know where to start? Before Bill Gates and Paul Allen launched Microsoft, they closed up shop on their Traf-O-Data concept, while Frederick W. Smith’s success with FedEx couldn’t shield him from a costly lesson with Zapmail.