The Wayback Machine - https://web.archive.org/web/20240820015957/https://www.geeksforgeeks.org/control-structures-in-programming-languages/
Open In App

Control Structures in Programming Languages

Last Updated : 16 Jan, 2020
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

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:
             [Module]
      [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

      Implementation:

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

      Repeat while condition:
           [Module]
      [End of Loop]
      

      Repeat While Flow

      Implementation:

    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 11 Popular Programming Languages
In this rapidly growing world, programming languages are also rapidly expanding, and it is very hard to determine the exact number of programming languages. It is an essential part of software development because it creates a communication bridge between humans and computers. Now, if you are a beginner who wants to learn, search the internet, you w
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
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
5 Best Languages for Competitive Programming
Needless to say, Competitive Programming is one of the most crucial and popular aspects of a programmer's journey. Though, all the programmers are strongly recommended to participate in such coding challenges to enhance their coding skills and to get various ravishing prizes, rewards, and other career opportunities. Meanwhile, there's a question th
5 min read
Top Dying Programming Languages in 2020
If you're a 90's kid, you must have heard about LOGO - Language for Graphics Oriented (right, Turtle Graphics!!) that was particularly designed for children to teach them programming. Similarly, you must be familiar with other renowned languages like ALGOL, BASIC, COBOL, and many more. But do you know there is one thing common with all these langua
8 min read
The Evolution of Programming Languages
Programming Language is indeed the fundamental unit of today's tech world. It is considered as the set of commands and instructions that we give to the machines to perform a particular task. For example, if you give some set of instructions to add two numbers then the machine will do it for you and tell you the correct answer accordingly. But do yo
4 min read
How Programming Languages are Changing the World?
Programming has been revolutionizing the world since the advent of the first software or a code-based project. Programming or coding has opened numerous new ways and paved the way for innovation in almost every industry. Today, with various types of coding languages available and modern tech-powered tools to assist, something new and innovative is
6 min read
Top 10 Metaverse Programming Languages For Game Development
The Metaverse is a transformative virtual space, revolutionizing our interactions, gaming experiences, and digital content consumption. In this evolving landscape, game development plays a vital role in shaping the Metaverse. Programming languages serve as the foundation, empowering developers to craft immersive and captivating experiences within t
8 min read
7 Highest Paying Programming Languages For Freelancers
Programming is a lucrative career domain that promises an astonishing future, extremely high salary, global recognition, and extensive stability. As per the latest reports, programming jobs are expected to rise by 21% by the year 2028. Freelance programmers are self-employed individuals who decide their clients, rates, working hours, and places by
7 min read
Top 10 Programming Languages to Learn in 2023
Content has been removed from this post.
1 min read
Top Programming Languages For iOS App Development
Content has been removed from this post.
1 min read
Articles on Programming Languages
Articles on Programming LanguagesCC++JAVAPython Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above
1 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
Top 5 Programming Languages and their Libraries for Machine Learning in 2020
If you are a newbie in machine learning you may have thought that what programming language should I learn? Nowadays different people are working with different programming languages but among these many popular high-level programming languages, which one is the best for machine learning? Machine Learning is one of the fastest-growing fields which
6 min read
Top 10 Object-Oriented Programming Languages in 2024
In the present world, almost all sectors make use of software applications or computer programs that require to be coded. Programming Language is a set of instructions used in specific notations to write computer programs. It, basically tells the computer what to do. All Programming languages are not the same, they fall under different types namely
9 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
Best Programming Languages for Data Science in 2024
In today's data-rich world, data science plays a crucial role in unlocking valuable insights from vast amounts of data. With an exponential increase in data production, the need for skilled data scientists proficient in programming languages tailored for data analysis and machine learning has never been more critical. This article compiles the top
8 min read
10 Most Popular Programming Languages in India[2024]
India's IT sector is one of the leading business arenas filled with innovations and engineering and technological revolutions the world over. With an army of more than 4.4 million software developers as of 2024, India has metamorphosed into a resource for global technology talent. The country produces more than 1.5 million engineering graduates eve
15+ min read
Top Highest Paying Programming Languages in 2024
Imagine being able to command a salary that’s 20% higher than your peers simply by mastering the right programming language. In today’s rapidly evolving IT industry, certain high-paying programming languages can significantly boost your career and earning potential. According to the Stack Overflow Developer Survey 2024, developers skilled in top-pa
15+ min read
Top 10 Fastest Programming Languages
There are approximately 700 programming languages in the world. In simple words, a programming language is used to give instructions to the computer to perform the task which we require. Have you ever wondered which is the fastest of all the programming languages in terms of execution speed? In most cases, speed is not the only metric to choose whi
8 min read
Top 20 Programming Languages to Learn in 2024: Comprehensive Guide
In the modern world of software development, picking up the right programming language becomes cardinal to the success of any project. With new technologies emerging and the demands made from within industries changing with every passing day, staying updated with the best programming languages can give developers a huge edge in this regard. This co
15+ min read
"Hello World" In 30 Different Languages
In this article, we are going to see how to print "Hello World" in 30 different languages. It includes languages like C, C++, Cobol, Scala, Matlab, C#, CoffeeScript, Delphi, Dart, Haskell, Pascal, Ruby, Python, Assembly, R, Swift, Kotlin, PHP, Java, Go, F#, Lisp, JavaScript, Algol, Perl, Tcl, TypeScript, Fortran, Bash (Unix Shell) and HTML. Now, le
13 min read
Top 10 Languages For Full Stack Web Developement
Hey Geeks, fellow web developer! Have you ever heard the word full stack Web developer? As a full-stack developer, you have the superpower to create complete, top-notch web applications from scratch. But to reach superhero status, you need to get familiar with a variety of programming languages that play different roles in the development process.
10 min read
Difference between Functional Programming and Object Oriented Programming
What is Functional Programming?In functional programming, we have to build programs using functions. An example of functional programming is Haskell language. What is Object Oriented Programming?Object-oriented programming is built by using classes and objects. In this, we have concepts of encapsulation, inheritance, polymorphism, and Data abstract
3 min read
Structures in C++
We often come around situations where we need to store a group of data whether of similar data types or non-similar data types. We have seen Arrays in C++ which are used to store set of data of similar data types at contiguous memory locations.Unlike Arrays, Structures in C++ are user defined data types which are used to store group of items of non
5 min read
Article Tags :
three90RightbarBannerImg