Friday, September 15, 2023

Control Structures in Programming Languages

 

Control Structures in Programming Languages


Control Structures are  a way to specify flow of control in programs.  It basically analyzes and chooses in which direction a program flows based on certain parameters or conditions. There are three basic types of logic, or flow of control


  1. Sequential flow
  2. Conditional flow
  3. Iteration flow
1. Sequential Logic (Sequential Flow)

Sequential logic as the name suggests follows a serial or sequential flow in which the flow depends on the series of instructions given to the computer. Unless new instructions are given, the modules are executed in the obvious sequence. The sequences may be given, by means of numbered steps explicitly. Also, implicitly follows the order in which modules are written. Most of the processing, even some complex problems, will generally follow this elementary flow pattern.






Conditional Flow

In this flow structure instructions are proceed on this basis of given conditions.  The structures which use these type of logic are known as Conditional Structures. These structures can be of three types:

  • Single Flow (Only If)
    If (condition) then:
         [Module A]   
    [End of If structure]

Double Flow (If... Else....)Structure
If (Condition), then:
     [Module A]
Else:
     [Module B]
[End if structure]





No comments:

Post a Comment