Select Page

Hello, all!

I am very pleased to announce a new series for the blog called CS Wisdom. As a Computer Science major and spiritual being, I oftentimes deepen my understanding of metaphysical concepts using computational logic. CS Wisdom is a guided exploration through Computer Science topics with a focus on their everyday applications. At the end of each article, you’ll have an understanding of a CS topic and how to use it to better your life.

With that being said, let’s dive into the first concept — infinte loops.

Concept: Loops

In CS, loops are structures used to execute a set of commands until a parameter is met or proven to be false. There are many types of loops, but for the sake of this example, I’ve chosen a while loop. It’s simple — a while loop will execute while its condition(s) remains true. Below is an example.

In the example, I created an integer variable, x, and assigned it to the value 0. Then I established a loop that will run while x is equal to 0. Since x is never updated, the loop will run infinitely. Thus, we have an infinite loop and a very big problem.

``````// define a variable
int x = 0;

// establish loop and its conditions
while( x == 0 ) {
// execute commands
}``````

If we executed the above code, there’s a good chance your device would crash or significantly slow down. Infinite loops are problematic because they keep eating up resources until a system can no longer function. Therefore, it’s important that we know how to identify and fix them.

Identifying the Loops in Your Life

First things first: loops are not inherently bad. They are fantastic tools. They only become problematic when they begin taking up too many resources. If you took an inventory of your weekly schedule, you’d likely see a few loops. They could be anything from the days you work to your nighttime routine. You probably don’t notice their existence most of the time. This is good. These are not the loops that need to be fixed.

The loops that need to be fixed are the ones that trap you and/or consume lots of your resources. These are your infinite loops in everyday life. They can be sneaky and can hide in plain sight. I’ve listed some common ones below:

• Frequently eating unhealthily
• Working in a toxic environment
• Consistently arguing with a partner
• Excessive use of social media apps

Though the above items are good examples of infinite loops in everyday life, remember that a loop only becomes infinite when it feels like it’s out of your control and/or uses more resources than it should. Checking Facebook isn’t bad, but living in a digital world to avoid the present is. Therefore, most events can manifest as infinite loops if left unregulated. It’s a good practice to be mindful of where they exist.

Breaking an Infinite Loop

As previously mentioned, infinite loops occur because their parameters are incorrect or not properly updated. In the above example, x was never updated, so the loop could not break. This could be fixed by either updating x in the loop or by creating new loop parameters that allow for a clear exit. In Java, the following code would solve your problem. The loop would execute once, and the program would continue to run.

``````// define a variable
int x = 0;

// establish loop and its conditions
while( x == 0 ) {
// execute commands
// update x
x = 1;
}
// continue program``````

As done in CS, we can break the infinite loops in our lives by finding the parameters that don’t work for us. Don’t worry — no coding required, just objective analysis. For every infinite loop, ask yourself “Why do I do this?” and “What can I change to make this stop?” Be critical, but kind. Oftentimes, you’re the parameter that needs some updating. That is perfectly okay. The work that needs to be done is humbling and challenging. Yet, it is work that you are uniquely capable of doing. Create a plan, and give yourself time to put in the work.

Remember that you are not a machine. You are not a program that can be adjusted in seconds and optimized in hours. You are human, and the work necessary to break any infinite loop will take time. Work out of the loop on your own schedule. Methodically adjust the parameters in your life to find what does and does not work for you. Infinite loops can also be described as karmic lessons that must be learned. Give yourself enough time to learn the lesson, and congratulate yourself on taking this step towards awareness. You’re doing so well.