Computer Languages
Control Structures
[ Back to Lecture Notes ]
Computer instructions reflect the operations a computer can perform and
the tasks we want it to accomplish:
- Transfer data from one location to another
- Input data from a device and output data to a device
- Store data in memory and retrieve data from memory
- Compare data values for equality or inequality
- Perform arithmetic operations
Control structures are used to express algorithms as programs. Four
basic ways to structure statements (instructions) in most languages are:
- Sequentially
Statements executed one after another in order
- Conditionally
IF ... THEN
- Repetitively
Loops: WHILE ( condition )... LOOP; DO ... LOOP;
FOR ( condition )... NEXT
- Via Subprograms
Procedure, Function, Method, Subroutine
CALL ( subprog ) ... RETURN
Sequence

Sequential Program Control
[ TOP ]
Selection

Conditional Program Control
[ TOP ]
Loop

Repetitive Program Control
[ TOP ]
Subprogram

Control via Subprograms
Also called procedure, function, method, or subroutine
[ TOP ]
Revised: 19 JAN 2002 22:25