Flow Control Of A Computer program Process – Computer Basics study materials

basics


The flow of control (or simply control flow) is how a program processes its instructions.Typically, programs operate in a linear or sequential flow of control. Executable statements
or instructions in a program are performed one after another. In source code, the order that instructions are written defines their order. Just like English, a program is “read” top to bottom.

Each statement may modify the state of a program. The state of a program is the value of all its variables and other information/data stored in memory at a given moment during its execution. Further, an executable statement may instead invoke (or call or execute) another procedure (also called subroutine, function, method,
etc.) which is another unit of code that has been encapsulated into one unit so that it can be reused.

This type of control flow is usually associated with a procedural programming paradigm (which is closely related to imperative or structured programming paradigms). Though this text will mostly focus on languages that are procedural (or that have strong procedural aspects), it is important to understand that there are other programming language
paradigms. Functional programming languages such as Scheme and Haskell achieve computation through the evaluation of mathematical functions with as little or no (“pure”
functional) state at all. Declarative languages such as those used in database languages like SQL or in spreadsheets like Excel specify computation by expressing the logic of computation rather than explicitly specifying control flow.



Flowcharts

Sometimes processes are described using diagrams called flowcharts. A flowchart is a visual representation of an algorithm or process consisting of boxes or “nodes” connected
by directed edges. Boxes can represent an individual step or a decision to be made. The
edges establish an order of operations in the diagram.Some boxes represent decisions to be made which may have one or more alternate routes
(more than one directed edge going out of the box) depending on the the result of thedecision. Decision boxes are usually depicted with a diamond shaped box.Other boxes represent a process, operation, or action to be performed. Boxes representing

a process are usually rectangles. We will further distinguish two types of processes usingtwo different colorings: we’ll use green to represent boxes that are steps directly related
to the algorithm being depicted. We’ll use blue for actions that are necessary to thecontrol flow of the algorithm such as assigning a value to a variable or incrementing a value as part of a loop.

Leave a Reply