Here’s the unfortunate truth: regardless of how much time you put in at the gym, you can still have your weight remain stagnant or even gain weight.

Why is this the case? It all boils down to calories in, calories out. Say you spend two hours on the treadmill at the gym, and you burn a total of 400 calories during these two hours. If you decide to treat yourself to a burger after your gym session, you may end up consuming more calories than you’ve just burnt, and flushing your hard work down the drain.

Post-workout food: How do you eat without going overboard?

So, here’s the question: how do you eat in a way that doesn’t undo the time you put into exercising? The answer lies in being careful about what you eat. However, this is easier said than done, especially when you’ve already exercised all your willpower to get yourself to the gym, and you’re now craving something that’s decadent and high-calorie.

Pro-tip: Decide on your post-workout snack before you start working out

Thankfully, there is a little-known trick that you can use to get around this. Simply decide on your post-workout meal or snack before you start working out, instead of after. According to a new study from the University of Nebraska-Lincoln, this can help you to make better decisions, and keep temptation at bay.

In this study, researchers split their participants into two groups. Prior to exercising, the first group decided whether they wanted to have an apple, brownie or no snack after their workout. The second group made the same decision, but did so after they were done exercising.

The results? Those who were asked about their post-workout snack before exercising generally went with healthier options. 74% of the first group and 55% of the second group chose to have an apple, while 14% of the first group and 20% of the second group went for the brownie instead.

Christopher Gustafson, co-author of the study and assistant professor in the Department of Agricultural Economics at the University of Nebraska-Lincoln, states that the results are consistent with prior studies, showing that people are more willing to indulge when making “immediate dietary decisions” than when thinking ahead.

The bottom line? If your goal is to lose weight, you're better off making the choice before you go to the gym, not when you're done with your workout and hankering after a sinful treat!