Hi there! I am Studyfin, your coding tutor. Today, we will learn how to make our code repeat tasks easily using loops!
Sometimes we need to do a task many times, like taking ten steps forward. Writing the same code ten times is slow and messy. We use a design process to find these repeating steps and make them simpler.

A loop is a programming tool that repeats a block of code. Instead of writing 'step forward' five times, we write it once inside a loop. The loop tells the computer to repeat that action five times.
We can use loops with conditionals, which are 'if-then' decisions. For example, a loop can repeat a task 'until' a path is blocked. This helps our programs solve everyday problems dynamically.
Imagine you are building a game where a character must water 5 plants in a row. Let us design a simple program to solve this everyday problem using a loop instead of writing the same code 5 times.
- Analyze the problem: Identify the actions that repeat. The character needs to 'water' and then 'move right' for each plant.
- Plan the sequence: Without a loop, the code would be: Water, Move, Water, Move, Water, Move, Water, Move, Water, Move.
- Create the loop: Group the repeating actions into a single block: 'Water' and then 'Move right'.
- Set the loop limit: Tell the loop to repeat exactly 5 times so the character stops after the last plant.
- Test the program: Run the loop. The character waters a plant, moves, and repeats this sequence until all 5 plants are watered.
