Control Structure
The control structure is the name given to one of the instructions, statements, or groups of statements in a programming language that coordinates the sequence in which another instruction or statement is executed.
The path from control statement to the execution of the function is known as the control flow. The control structure is especially useful when the control flow is not sequential--when certain instructions in the sequence need to be repeated, or when some instructions in a sequence are only executed under certain conditions. The use of control structures allows the program's control flow to be altered in a controlled fashion.
The executed statement is typically in response to a user command (also known as an event-driven command). For example, when a graphic icon, such as a button, is pressed, a control structure is activated to coordinate the execution of whatever function is associated with the button. Consequently, there are many control structures that are associated with the numerous push-buttons, scroll bars, and pull-down menus of a graphical user interface.
The control structure is the routine that is the interface between a computer and a requested task. The control structure determines what function is to be performed and calls the routine that performs the desired task. For example, in a software program that allows an interfacing of a computer and a telephone, the coordinating routine is called CONTROL. When input from the host computer is received, CONTROL calls the REC_COM routine. REC_COM compares the input against a list of acceptable commands. If the input is acceptable REC_COM in turn calls the routine that actually executes the requested function.
A number of applications utilize control structures. One example is the execution of phone related commands in interfaces between computers and telephones. Another example is the execution of certain interactive graphical applications in programming languages like Prolog, where the execution of a task is in response to a user request,
Control structures are used in assembly language—the symbolic representation of the machine language of a specific computer--where they consist of functions called jumps and conditional jumps, procedure call and return, loop instructions, or the conditional execution of instructions. The most common control structure is the "if, then" structure. Examples of control structures, in assembly language and other programming languages, include the following (taken from the reference):
- "if CONDITION then EXPRESSION else EXPRESSION"
- "switch statement"
- "while CONDITION do EXPRESSION"
- "gosub"
- "goto"
- "come from"
Control structures are being studied as a means of achieving the complete monitoring and control over all activities on a computer and the network to which it is a part. The potential benefits of this use of control structures would be an increased automation of basic tasks and an increased user monitoring capability.
This is the complete article, containing 443 words
(approx. 1 page at 300 words per page).