This programming concept can help you finally forgive

Written by:

We’ve all been there. That moment when a past hurt resurfaces, bringing with it a tidal wave of emotions you thought you’d moved past.

You’ve said you’ve forgiven, you’ve tried to let go, but somehow, the resentment keeps creeping back in.

What if I told you that the solution to breaking this cycle lies in an unexpected place – basic programming concepts?

As someone who juggles full-time work, a Master’s degree, relationships, and various hobbies, I’m always on the lookout for efficient ways to manage not just my time, but also my emotional well-being.

Today, I’m excited to share a powerful (and ridiculously simple!) insight I’ve gained from my Python class that has given me a breakthrough on letting go.


The concept

In programming, one of the early concepts you learn is a “while loop”

Basically, you tell the program to keep printing an output, as long as a condition is true.

For example, you tell the program to count. And while the numbers are less than 6, you tell it to print as many asterixes as the number it counted.

In Python code, it looks like this:

level = 1

symbol = '*'


while level < 6:

     print(level)

     print(level * symbol)

     level = level + 1

Paste it into a console, and it will give you this:

1 *

2 **

3 ***

4 ****

5 *****

The trick is that you need to include a mechanism to make the loop stop — in this case, the numbers increase, and there is a condition to stop once it hits number 5.

If we remove that last line (level = level + 1, which increases the number by 1 each time the program runs), then the program would keep printing “1 *”. And it would keep printing it, because the condition “level is less than 6” would always be true.

So you end up with an infinite loop that just keeps on printing, forever and ever. (Or until you quit the program).

How to use it to forgive better

And suddenly, I understood why forgiveness doesn’t seem to work for some people.

You see, it’s one thing to say you forgive — and it’s another to never think about the event again.

Eventually it pops back into your mind, and makes you feel all the feelings again.

It’s like you get stuck in an infinite loop: “while this memory feels unfair, run the rage program.”

But thinking about it this way also gives you the way out.

All you need to do is build in some condition that decreases the emotional output every time you “run the program”.

For example:

While memory feels unfair:

       run rage program

       and decrease unfairness by 1%

With this added mechanism, the “unfairness” aspect decreases every time the program runs, until eventually, it will hit 0% — and the program stops running.

And now, you have a way out — even if it takes dozens of iterations to get there. (Still better than a lifetime of bitterness and toxic energy).

Of course, you have to do something consciously to make the memory feel less unfair when you remember it.

But thinking about it like this — and making it into a logical algorithm with a clear exit — can help your mind see it as easy enough to actually commit to doing it.

Recap & action steps

  • Programming has a command called “while loops”, which means a program keeps running as long as a condition is fufilled (for example, until the program counts up to 5, it will keep printing that number of asterixes).
  • We can think of emotions we get stuck with as “while loops” with no exit strategy – they “run” our resentment program over and over again with no change.
  • To help your mind and heart let go, imagine building in a condition that decreases the resentment every time you recall the memory. Even if it takes many iterations, eventually, the resentment will hit zero.

What are your thoughts? What helps you let go of anger when you recall a past hurt?

I’d love to hear it in the comments below!

Leave a comment