For the young, regret over poor choices or missed opportunities can be a powerful carrot: It sparks reappraisal, accelerates learning and motivates change.

In the old, regret appears to be no better than a stick, a stern reminder of poor choices, lost powers and our short time left on Earth.

So what’s the key to happy old age? Don’t lunge after the carrot and you won’t get hit by the stick.

A new study finds that how we deal with foregone options and lost opportunities makes a huge difference in whether we will grow into happy seniors or succumb to late-life depression. Reporting their findings in Science magazine, German researchers found that in repetitive games of chance, when healthy young adults pay a price for a wrong decision, they shift their strategies accordingly in the next round. If their caution lost them a big payoff, they’ll be bolder in the next game; if they risked too much and came up empty-handed, they’ll become more cautious the next time around.

Their response to regret is to act on it. And their physiological response to that regret was active, too: Their heartrates increased and their skin became clammy.

Like miniskirts, muscle shirts and long hair, what worked well for young people did not work so well after age 50. Among older subjects (40 adults with average age of 65), the 20 who had experienced late-life depression (defined as a first episode of depression after age 55) were far more likely to respond to regret in the same way a healthy young person would: Their hearts would pound, their hands would get moist, and they would adjust their playing strategy in the next game.

The emotionally healthy older adults, however, were like Zen masters in the face of regret: Whether they went all in and lost or held and lost had no bearing on how they played the next game. Their palms stayed dry and their hearts did not race.

Had depressed older adults simply made more poor decisions, leading to more regret? Or did their tendency to blame themselves more for their losses make them depressed?

This study doesn’t answer that. But it does suggest that while dwelling on regret may serve us well in youth, doing so as we age will just make us unhappy.