The U.S. economy has been in a recession for quite some time, and while the stock market hasn't been affected too negatively thus far, that could very well change during the latter part of the year. In fact, there are numerous factors that could lead to a stock market plunge similar to the one that occurred back in March:

And let's not forget the fact that we're in an election year, which puts the stock market on already shaky ground.

Thankfully, stocks have largely recovered from March's crash, but when we consider the points above, it's easy to see why anyone would be skittish about investing at a time like this. But if you're worried about putting money into the stock market, one key piece of advice from investing guru Warren Buffett might get you to change your tune.

Man at laptop with serious expression

Image source: Getty Images.

Focus on opportunity over risk

Investing in stocks is always risky, and during a recession, the prospect can be even more daunting. But rather than fixate on what you stand to lose by investing during a recession, consider instead what you have to gain.

As Warren Buffett himself says, "Bad news is an investor's best friend. It lets you buy a slice of America's future at a marked-down price."

When stock values decline (during a recession or otherwise), it gives you, as an investor, an opportunity to load up your portfolio on the cheap. In fact, some of the stocks you've been following that may have otherwise been out of reach could suddenly become affordable in the second half of 2020, and if you have the cash on hand, you might land in a position to build a solid portfolio that serves you well long into the future.

Now you may be thinking: "But what about the stocks I already own?"

While it's true that those might lose value at some point in the course of our current recession, it's also true that if you leave your portfolio alone and don't sell investments off at a loss, you won't actually be out any money. Therefore, try not to worry about your existing portfolio, but rather, focus on the opportunity you have to add to it.

Of course, this doesn't mean you should randomly buy stocks just because they're down. Rather, make a watch list of the stocks you've vetted and are eager to buy, and then load up on those when the opportunity presents itself.

It pays to take a chance

It's easy to invest in stocks when the market is steadily going up. When it's volatile, less so. But remember, if you take a long-term approach to investing, you're likely to come out ahead in the end. And if you jump on the opportunity to buy stocks during a recession, and then hold those stocks for many, many years, there's a good chance you'll wind up more than happy with your decision.