Home » Programming » 06 - Statement Level Control Structures
6

Sequences

Sequences in a program are the order in which the operations are executed.

Control structures are the way operations and data are combined in order to come up with a program. Programming languages follow a certain way of organizing its data within a framework. Without this framework, it would be utterly impossible to put programs together.

Imagine building a house. Before you build a house, you need a blueprint. Statement level control structures are like the parts of the blueprint that illustrate how a room will be built, how big the bathrooms will be, and how large the dining area is. Statement level control structures allow you break down your programming tasks into smaller tasks that can be organized and manipulated the way you want.   

Sequences

Sequences in a program are the order in which the operations are executed. Sequences may be structured within expressions, between statements or group of statements, and between subprograms (subprograms will be discussed in more detail in the next chapter). There are two basic types of sequence control. Implicit sequence control is sequence control that is embedded within the programming language itself. This can only be changed if the programmer decides to modify it. When the programmer modifies the implicit sequence control, the modifications are said to be explicit sequence control already.

“Goto” is an explicit sequence control. The “Goto” statement directs the program to transfer control to a specified command line or label name. A “Goto” statement can be executed under certain conditions or unconditionally. A “Jump” statement is also infused within the source code of the “Goto” statement. Use the Visual Basic Editor for your first Goto statement. An example is given in the illustration below.

Notice that if you remove the "GoTo" statement, the result in the Message Box will be "2" but if you use the "GoTo" statement, the result in the message box will be "1" because the program completely jumps to the "MESSAGER" line and skips an entire line of code.

Another similar command is "Break." “Break” is an explicit sequence control. The “Break” sequence control is used mainly to move forward to a specified point in a program. It normally exits from the current control structure. The “Continue” statement, on the other hand, exits the current operation and prepares for another operation within the current control structure. In loops, a “Break” statement exits the loop while a “Continue” statement iterates the loop all over again.

Sequence control basically allows you to tell where and when to "go to" a specific line, when and where to take a "break," and when and where to "continue" doing the said task.