Well, you aren't necessarily better sitting out entirely.
When the stock market slumps like that, continual investment lowers your average cost basis.
e.g.:
Year 1: Buy 1 stock at $100
Year 2: Buy 1 stock at $50 (post-crash)
Year 3: Buy 1 stock at $60
Year 4: Buy 1 stock at $70
Year 5: Buy 1 stock at $80
If we just look at "Year 1 = $100, Year 5 = $80" then it looks like we lost $20/share.
However, our average cost basis is $72, so we actually made $8 per share.
That’s not really a great return but it’s not horrible considering the circumstances.