The stock market has experienced a sharp decline, or even crashes, several times over the years. No two plunges are alike, and the causes are diverse -- including computerized trading in 1987, the 9/11 attacks in 2001, the global financial crisis in 2008, and the COVID-19 pandemic in 2020. Often, these events are what investors call black swans, meaning they are nearly impossible to anticipate.

Other market shocks are easier to predict. For instance, the current debt ceiling crisis has thrust the possibility of a crash back into the headlines. If the president and Congress cannot reach an agreement, the U.S. could conceivably default on its obligations, and the stock market could plummet. Most agree that a deal will be made because the stakes are so high; however, it could come down to the wire, and investors should be prepared.

So what are the dos and don'ts for investors during a plunge?

1. Don't Panic!

This seems obvious, but it's human nature. We want to take immediate action when threatened. But this is usually a bad idea for investors. The stock market experienced two record-setting down days during March 2020, and things looked dire. Popular and highly successful companies such as Amazon, Microsoft, Apple, and Intuitive Surgical were in free fall, as shown below.

AMZN Chart

Data source: YCharts AMZN

Panic selling was a poor move as each stock was up less than four months later.

AMZN Chart

Data source: YCharts AMZN

Keeping a level head when the market turns south is probably the most essential quality of a successful investor. It's often best to just turn off the computer and go for a long walk during these crisis days. As Warren Buffett says, "The most important quality for an investor is temperament, not intellect."

2. Don't lose sight of long-term goals

While busy not panicking, take some time to reaffirm your focus on long-term goals. Wealth creation is a marathon, not a sprint. On Oct. 19, 1987, the stock market plummeted more than 20% in an event dubbed Black Monday. One reason for the crash was automated trading, which was fairly new. A series of news items increased sell orders, the situation snowballed, and many sold in a panic (see rule No. 1).

Companies' fundamentals and long-term investment cases hadn't changed, and the market fully recovered two years later. In one example, Walmart fell 28% during October 1987. But it was still an excellent company and has returned more than 4,700% since.

In fact, looking at the stock market on a long-term timeline makes this "crash" look like a non-event. See if you can spot it on the left side of this chart:

^SPX Chart

Data source: YCharts ^SPX

The market looks a lot different when viewed through the lens of long-term investment goals. Owning terrific companies for the long haul is a money-making strategy.

3. Don't stop investing

It's tempting to avoid buying stocks altogether when things look uncertain. Who wants to take the risk? Some try to wait until the economic turmoil clears up before diving back in. The problem is that this market-timing strategy is ineffective, as study after study shows. It's just too difficult to accurately and consistently predict ups and downs. Some of the market's best days often come when least expected (and during a bear market), and being out of the market and missing them can decimate long-term returns.

It's also critical to keep investing to take advantage of low stock prices. A strategy such as dollar-cost averaging (buying shares of a company consistently over time) is one way to do this. If you are putting a monthly amount into a 401(k) or similar investment account, this is already a terrific setup. By continuing to invest, we can keep our portfolios intact, continue collecting dividends, not worry about market timing, and benefit from price declines in the long run by buying when stocks are on sale.

Stock market crashes aren't much fun, but they will happen from time to time. The best path to success is keeping a level head, maintaining a long-haul strategy, and continuing to invest. Your future self will thank you.