| Chapter5 | 5.1.0- An Example in Plain English >> |
ASP Control Structures
In the first several chapters of this book, you have been writing simple Active Server Pages using VBScript code. Up until now your code has been read and executed in a very simple order: line 1 first, then line 2, then line 3 and so on until the last line, or occasionally we've repeated a small section of code several times. But in the real world, scripting languages can operate in a more complicated way than that: given certain conditions, they can skip or repeat lines – or groups of lines. This chapter will teach you ways to change the order in which the lines of your code are executed.
This chapter covers the three ways that you can use VBScript with your ASP scripts to sequence the execution of your lines of code. Respectively, these are:
- Deciding which of two or more sections of code to run.
- Repeating a section of code as many times as needed.
- Jumping out of the code sequence and executing sections of code in another part of your script.
Note that this chapter refers to using VBScript with ASP, and hence some of the syntax shown in the following examples is specific to VBScript. If you were to try and use, for example, JavaScript, the structure of the examples would have to be changed appropriately. If you want to know more about JavaScript, you may be interested in Beginning JavaScript 3rd Edition (Wrox, ISBN 0-470-05151-5).
Before we look at these processes in detail, let's step back and think in more general terms for a moment.
| Chapter5 | 5.1.0- An Example in Plain English >> |

RSS
