When it comes to programming, there are a few staples that all coders should know. Arrays, loops, and conditional statements are some of the most basic building blocks of any code.1 Loops are sequences of instructions that repeat until they meet a specific condition. What is the history behind this construct? Who designed and used it the first time? In this blog post, we will take a closer look at loops in programming and explore how they came into being.

Charles Babbage and the Analytical Engine

The first mechanical computer, known famously as the Analytical Engine, was designed by Charles Babbage in 1837. This engine was the successor of the Difference Engine. The uniqueness of an Analytical Engine lies in its inclusion of both CPU (Central Processing Unit) and ALU (Arithmetic Logic Unit). Moreover, Babbage employed loops and conditionals in the programming language for this machine.2

The groundbreaking design of this engine and the use of loops in its programming paved the way for improved features in modern processors. The programming in the Analytical Engine included the use of punched cards, branching operations, and nested loops.3 A loop within another loop is known as a nested loop. These loops generally represent multidimensional data. Hence, the Analytical Engine was one of the first instances that saw the employment of loops in programming.2

Exploring the Concept of Loops for the First Time

Ada Lovelace, a London-born mathematician, is also referred to as the first programmer in the world due to her outstanding work in designing complex codes for the Analytical Engine way back in the 1840s.4 When Babbage was on the verge of giving up on his work due to the sudden halt in government funding, Lovelace stepped in. She translated the French article on Analytical Engines to English, adding her notes.5 Here are some reflections from her notes: 

  • She explained how to code on cards with punched holes by correlating it with the working of a Jacquard weaving loom, a device that employed punched cards to automate repetitive or looping patterns in the fabric.4
  • Her notes incorporate her knowledge and love of embroidery to explain the similarity in patterns in mathematical calculations.4 She used nested loops and conditionals in her programming instructions to avoid duplication of steps.
  • She was probably the first programmer to recognize the importance of organizing mathematical and computing operations into groups, thereby inventing the concept of loops in programming languages.5

When Were the First Programming Loops Run Officially?

The ENIAC (Electronic Numerical Integrator and Computer) was the first electronic, general-purpose computer designed in 1946.10 J. Presper Eckert and John W. Mauchly invented this fast and reliable machine. Not only could the ENIAC perform basic mathematical operations, but it could also store results and run conditionals and nested loops.6

The only drawback was that this machine could not store programs. Consequently, one had to set up the programs locally and manually on different machine units.6 The process was too tedious and time-consuming. However, the idea of repetitive calculations or programming loops in modern processors originated here.

Looping and Recursion

Recursion and looping are programming concepts used to develop complex codes. It is easy to confuse them as they appear similar. However, one must know the difference between their functions. Loops are employed to carry out instructions repeatedly until the conditions are met. Recursions use smaller versions of the same problem (subproblems) to arrive at a solution.7

The Evolution of Loops in Programming

Over the years, loops have become integral parts of programming languages and coding instructions. Developers use loops all the while since they help in saving time.1 The four major types of loops used in programming today are:8

  • For loops – when you know the number of times you need to run the algorithm before stopping.
  • While loops – to repeat the same algorithm for an unknown (variable) number of times until it meets the condition.
  • Do while loops – repeating loops until the expression becomes false.
  • For each loops – used for looping with arrays.

The advantage of using loops in programming is that they narrow down a long series of repetitive codes to one instruction. Loops also allow the user or developer to express more in fewer statements. They also provide code reusability, meaning you can repeat the same code in various programs.9

Looping its Way Ahead

Loops have a long and varied history in programming. They are one of the most fundamental structures in code, and their applications continue to grow with the advent of new programming languages and software development approaches. 

If you found this article enriching, please visit BYJU’s FutureSchool Blog to read more informative pieces.


  1. Yse, D. L. (2020, January 22). Essential Programming | Control Structures. Medium. Retrieved December 13, 2022, from https://towardsdatascience.com/essential-programming-control-structures-2e5e73285df4
  2. The Engines | Babbage Engine | Computer History Museum. (n.d.). The Engines | Babbage Engine | Computer History Museum. Retrieved December 13, 2022, from https://www.computerhistory.org/babbage/engines/
  3. The Genius of Babbage’s Analytical Engine – DZone. (n.d.). dzone.com. Retrieved December 13, 2022, from https://dzone.com/articles/the-genius-of-babbages-analytical-engine
  4. The world’s first computer programmer was the daughter of a romantic poet who took inspiration from embroidery to write the first algorithm. (n.d.). Fortune. Retrieved December 13, 2022, from https://fortune.com/2022/12/09/who-is-ada-lovelace-early-computer-programmer-influenced-by-music-needlepoint/
  5. Ada Lovelace and the first computer program in the world | Generation Ready. (2022, July 6). Ada Lovelace and the first computer program in the world | Generation Ready. Retrieved November 12, 2022, from https://www.mpg.de/female-pioneers-of-science/Ada-Lovelace
  6. Programming the ENIAC: an example of why computer history is hard. (2016, May 18). CHM. https://computerhistory.org/blog/programming-the-eniac-an-example-of-why-computer-history-is-hard/?key=programming-the-eniac-an-example-of-why-computer-history-is-hard
  7. What is the Difference Between Recursion and Loop – Pediaa.Com. (2018, November 8). Pediaa.Com. Retrieved December 13, 2022, from https://pediaa.com/what-is-the-difference-between-recursion-and-loop/
  8. S. (2018, March 16). Guide to Use Loops in PHP | Blog | Loginworks Softwares. Loginworks. Retrieved December 16, 2022, from https://www.loginworks.com/blogs/use-loops-php/
  9. Guthrie, S. (2018, January 13). Loops, Types of Loops, and Loop Uses. Medium. Retrieved December 13, 2022, from https://medium.com/@seanguthrie/loops-types-of-loops-and-loop-uses-f3c8ddef3820
  10. Eniac. (n.d.). Encyclopedia Britannica. Retrieved January 4, 2023, from https://www.britannica.com/technology/ENIAC 

About the Author

More than just Coding and Math! Our proprietary, activity-based curriculum with live, real-time instruction facilitates: Problem Solving. Creative Thinking. Grit. Confidence. Communication