Home / MS-Access / Getting Started

Programming Basics: Decisions and Looping

When writing programs, it's important to understand how programs make decisions and perform looping. Looping is the process of carrying out the same set of instructions until certain conditions are met.

Programs also have to make decisions based on the parameters to which they have access. The computer program would also be very dull if it never made a decision. For example, if a program tries to load a text file and the file is not found, a decision needs to be made as to what to do next. Should the program simply display an error message and crash, or should it show some intelligence and alert the user that the file is missing and offer an alternative action?

By having your programs make decisions, you are introducing some primitive intelligence into your program. Admittedly, it is your intelligence that goes into the code, but it tells the program what to do in the event of different circumstances happening. You are effectively writing a set of rules to deal with various situations.

Looping is also something everyone does daily without thinking about it. When you eat a meal, you perform the same routine of taking food from a plate and putting it into your mouth. Computer programs frequently loop around the same piece of code a number of times until a certain condition is met.