With no cash flows, order does not matter: +20% then -10% and -10% then +20% both end at 1.08 times capital. Add withdrawals and order becomes decisive, because a loss early removes the capital that would have compounded later.
Example: $1,000,000 with $50,000 withdrawn each year. If the first three years return -20%, -10%, +30%, the balance after year three is roughly $736,000. Reverse the order to +30%, -10%, -20% and the balance is about $806,000. Same returns, $70,000 difference.
Defences include holding two or three years of spending in cash and short bonds, using a glide-path that de-risks into the withdrawal date, and cutting withdrawals in bad years. See safe-withdrawal-rate.
Related: safe-withdrawal-rate, glide-path, monte-carlo-simulation, dollar-cost-averaging, drawdown