There's been no shortage of recession predictions over the past year, and all of this uncertainty can be exhausting for investors. While it's still unclear when or if we'll face a recession, it's looking more likely. Even officials at the Federal Open Market Committee are predicting a "mild recession" later in 2023, so it may be time to start preparing for a downturn.

If a recession really is looming, should you still invest in the stock market right now? Or is it better to wait? Here's what Warren Buffett has to say about it.

Bad news is an investor's best friend

When the market is in a slump and the economy is on the brink of a downturn, it may seem like the worst possible time to invest. But to Buffett, these are the best times to buy.

Back in 2008, at the height of the Great Recession, Buffett penned an opinion piece for The New York Times to help reassure rattled investors. "A simple rule dictates my buying: Be fearful when others are greedy, and be greedy when others are fearful," he wrote. He added: "[B]ad news is an investor's best friend. It lets you buy a slice of America's future at a marked-down price."

If we face a recession, the stock market may have further to fall. While that's not necessarily a good thing, it does provide the opportunity to load up on quality stocks for a fraction of the price.

Some stocks have already fallen by 50% or more over the past year, and there have been few occasions since 2008 to buy at such steep discounts. Once the market recovers from this slump, it could be years before stocks are on sale like this again. In Buffett's words, now is your best chance to "be greedy."

A bull market is coming (sooner than you think)

Part of what makes downturns so difficult is that nobody knows how long they'll last. Some recessions only last months, while others can go for well over a year. The good news, though, is that the stock market is likely to recover before the economy.

In most cases, the market will experience the effects of investor uncertainty before the economy. For example, if investors are worried about a recession, stock prices will generally fall long before the recession actually begins.

But this also means that the market will almost always recover from recessions ahead of the economy. In fact, in nearly every recession over the last half century, the S&P 500 began a new bull market before the economy reached its lowest point, according to analysts from JPMorgan Chase.

For instance, during the Great Recession, the S&P 500 bottomed out in March 2009. The recession didn't officially end, however, until June of that year. During the months in between, the S&P 500 surged by close to 40%.

^SPX Chart

^SPX data by YCharts.

If you want to take advantage of the next bull market, it's wise to invest during the lowest lows and then wait for the rebound -- which will likely come sooner than you think.

As Buffett wrote in the Times article:

I haven't the faintest idea as to whether stocks will be higher or lower a month or a year from now. What is likely, however, is that the market will move higher, perhaps substantially so, well before either sentiment or the economy turns up. So if you wait for the robins, spring will be over.

It's not an easy time to be an investor, especially if more volatility is coming. But the stock market is safer than it seems, particularly over the long haul. By continuing to invest during the downturns, you can set yourself up for potentially lucrative gains during the recovery period.