About While
While loops allow you to repeat code. In order to repeat code you need to know when the code should start, when it should end and how many steps it must take from start to end. This is an over simplification but it helps when first starting out with loops.
Learn While loops can be tricky to learn for beginner coders. Although, on face value, they are easy to understand, it is the different ways we can solve problems using them which people struggle with. The first lesson will cover the basic anatomy of while loops before going into how they can be used to […]
Learn How can counter controlled loops be used to solve basic problems? In this lesson we will look at how you can apply basic problem solving skills to loop problems. I give you a three step solution to using counter controlled loops. Write the code to be repeated. Write the counter controlled loop. Combine. Try […]
Learn Condition controlled loops will not run a predictable number of times and tend to be controlled by the user. However, the way we solve problems using them is VERY similar. Write the code to be repeated. Set up the start and end points. Write how we will get from the start to the end […]
Learn Condition controlled loops will not run a predictable number of times and tend to be controlled by the user. This is ideal for presence checks because we have no idea how many mistakes the user will make. Try Write a secret number guessing game. The program will pick a random number from 1 to […]
Key term
Iteration – The process of looping over a section of code. A single loop is known as an iteration.
Helpful links
Some sample code for while loops
Introducing while loops
Kahn academy – while loops (video)
Using boolean variables and while loops (example)
Leave a Reply