Open In App

Control Structures in Programming Languages

Last Updated : 16 Jan, 2020
Like Article

Control Structures are just a way to specify flow of control in programs. Any algorithm or program can be more clear and understood if they use self-contained modules called as logic or control structures. 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, known as:

  1. Sequence logic, or sequential flow
  2. Selection logic, or conditional flow
  3. Iteration logic, or repetitive flow

Let us see them in detail:

  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.

    Sequential Control flow

  2. Selection Logic (Conditional Flow)

    Selection Logic simply involves a number of conditions or parameters which decides one out of several written modules. The structures which use these type of logic are known as Conditional Structures. These structures can be of three types:

    In this way, the flow of the program depends on the set of conditions that are written. This can be more understood by the following flow charts:

    Double Alternative Control Flow

  3. Iteration Logic (Repetitive Flow)
    The Iteration logic employs a loop which involves a repeat statement followed by a module known as the body of a loop.
    The two types of these structures are:

    • Repeat-For Structure
      This structure has the form:

      Repeat for i = A to N by I:
      [End of loop]

      Here, A is the initial value, N is the end value and I is the increment. The loop ends when A>B. K increases or decreases according to the positive and negative value of I respectively.

      Repeat-For Flow


    • Repeat-While Structure
      It also uses a condition to control the loop. This structure has the form:

      Repeat while condition:
      [End of Loop]

      Repeat While Flow


    In this, there requires a statement that initializes the condition controlling the loop, and there must also be a statement inside the module that will change this condition leading to the end of the loop.

Previous Article
Next Article

Similar Reads

Learn Programming Languages- List of Top 11 Programming Languages
.card { flex: 0 0 calc(33% - 10px); color: #fff; /* Bright text color for better readability */ text-align: center; background-color: #ffffff; /* Dark green color */ padding: 12px; /* Increased padding for a better visual */ margin: 10px; /* Slightly larger margin for better spacing */ border-radius: 10px; /* Rounded borders for a softer look */ bo
9 min read
Print "GeeksforGeeks" in 10 different programming languages
The most elementary part of learning any computer programming language is the ability to print a desired text on the screen or console. Thus, the task of this article is to guide programmers new to any of the 10 different languages discussed below, i.e. GO, Fortran, Pascal, Scala, Perl, ADA, Ruby, Kotlin, Javascript and C#. Prerequisites : The most
4 min read
Comparing Ruby with other programming languages
Ruby is an Object-Oriented language developed by Yukihiro Matsumoto in mid 1990’s in Japan. The Objective of its development was to make it act as a sensible buffer between human programmers and the underlying computing machinery. It is a pure object-oriented language and everything is an object on Ruby. Ruby is based on many other languages like P
4 min read
Introduction to Programming Languages
Introduction: A programming language is a set of instructions and syntax used to create software programs. Some of the key features of programming languages include: Syntax: The specific rules and structure used to write code in a programming language.Data Types: The type of values that can be stored in a program, such as numbers, strings, and bool
13 min read
5 Most Difficult Programming Languages of the World
You might have written your first code in programming languages such as C/C++ or Java and might have faced difficulty learning these languages. Well, these languages are at least readable or understandable but what if we say to write a program printing 'Hello World!' using spaces, tabs, and linefeeds only. We are not joking and actually there are s
6 min read
Top 10 Programming Languages of the World – 2019 to begin with…
If you are a newbie in the field of software development, the very first question comes to your mind is “Where to begin?” That’s undoubtedly true! There are hundreds to choose from, but how will you discover that yes, that’s the one? Which will be most suitable for you, your interests and career goals? One of the easiest ways to pick the best progr
9 min read
Difference Between Programming, Scripting, and Markup Languages
When it comes to making a website or app coding involves basically three types of languages i.e the programming language, Scripting Language and Markup Language. There are a lot of people who consider coding as just developing or making a website but they need to understand every single language fits into a particular category and we need to know w
4 min read
Role of SemiColon in various Programming Languages
Semicolon is a punctuation mark (;) indicating a pause, typically between two main clauses, that is more pronounced than that indicated by a comma. In programming, Semicolon symbol plays a vital role. It is used to show the termination of instruction in various programming languages as well, like C, C++, Java, JavaScript and Python. In this article
5 min read
A Categorical List of programming languages
Programming languages are the formal language, with a set of instructions which provides the desired output. For implementing various algorithms in our machines we started using the Programming language. A set of specific instructions are used in programmable machines, rather than general programming languages. Computer programming languages are us
7 min read
Top 10 Programming Languages for Blockchain Development
Do you ever wonder about the sudden emergence and popularity of Blockchain? What is it? Well, Blockchain is literally a chain of blocks as the name suggests! It’s just that the “blocks” in this context are digital information that is connected using cryptography. Each of these blocks contains a cryptographic hash function linking to the previous bl
7 min read
Article Tags :